'import quandl' produces 'Process finished with exit code -1073741819 (0xC0000005)'
Asked Answered
H

4

11

Here is my entire program:

import quandl

print("Hello World");

which results in:

Process finished with exit code -1073741819 (0xC0000005)

In the first place I imported Quandl, but then I received:

ModuleNotFoundError: No module named 'Quandl'

and then I googled it and read a suggestion to change the name to quandl.

I have installed the package in the project intercepter, there it's named Quandl though. Anyway, it looks like at least with the lower case it passes the compilation.

I run my program on Windows 10. My Python version is 3.7. I use PyCharm.

If I try to import a different package, then it works. Quandl is the problematic one.

Hushhush answered 28/7, 2018 at 16:40 Comment(7)
"Import quandl" means nothing if the package is not installed - that appears to be in your case. See this instructions : docs.quandl.com/v1.0/docs/python-installation. I use Quandl a lot and it works fine.Anodic
@Roberval_T_ I have installed the package. I mentioned that in my question.Hushhush
Windows 10 64 bit, Python 3.7.0, no errors. surely something wrong with your PyCharm settings.Yu
@MunimMunna that doesn't help me so much. Tell me what to check.Hushhush
IIRC 0xC0000005 means access violation, but judging by the quandls source code, it's pure python - are you sure it's quandl and not some dependency? Can you at least try import numpy, pandas first to see if those work?Incommode
@Incommode numpy does work, but pandas produces the same exception. Both are installed.Hushhush
If you can't even import pandas without getting an access violation, surely its installation is borked - did you install from wheel or source dist? What's your platform/ABI tag? (If you need commands to find them out, check my other answer). pandas has C extensions that are compiled to shared objects, so if done wrong, the installed files turn unusable.Incommode
I
1

Quandl is a pure Python distribution (containing only Python code), so when you get an access violation error on import quandl, it can either mean that:

  1. your Python installation is broken, which is not the case here as you mentioned other packages working, or that
  2. Quandl imports some broken dependency.

In your case, it's pandas causing the issue. First of all, check what platform/ABI tags pip reports on your machine:

  • pip<10:

    $ python -c "import pip; print(pip.pep425tags.get_impl_tag())"
    $ python -c "import pip; print(pip.pep425tags.get_abi_tag())"
    $ python -c "import pip; print(pip.pep425tags.get_platform())"
    
  • pip>=10:

    $ python -c "import pip._internal as pip; print(pip.pep425tags.get_impl_tag())"
    $ python -c "import pip._internal as pip; print(pip.pep425tags.get_abi_tag())"
    $ python -c "import pip._internal as pip; print(pip.pep425tags.get_platform())"
    

Be sure to use the correct Python version if you have multiple installed (version check with python --version); replace python with py -2 or py -3 if necessary.

The impl tag is an abbreviation for your Python implementation, usually CPython; for example, cp35 means CPython of major version 3.5 etc. The ABI tag consists of three parts: Python implementation abbreviation, impl version (same as in Python tag) plus the ABI flags (for example, m if your Python impl was built with --with-pymalloc etc). You platform should be either win_amd64 for 64 bit Windows, or win32 for 32 bit one.

Now check if there is a wheel with precompiled extensions available for your platform: go to https://pypi.org/project/pandas/#files and browse through the list of files. Look for a file pandas-0.23.4-{impl tag}-{ABI tag}-{platform tag}.whl.

PyPI wheels

If there is a wheel file suitable for your current platform, copy its link and run:

$ pip uninstall -y pandas
$ pip install https://copied-link-to-wheel-file

If pip uninstall fails, run

$ pip install --force-reinstall https://copied-link-to-wheel-file

instead.

third-party wheels

If no wheel is available from PyPI, you may look for other wheel sources; often https://www.lfd.uci.edu/~gohlke/pythonlibs contains prebuilt wheels for Windows. Check out the list of pandas wheels available there. If a wheel matches your platform, download it and run

$ pip uninstall -y pandas
$ pip install c:/path/to/downloaded/wheel/file.whl

building from source dist

If no wheels are available for your platform, you have to build pandas from source. In this case, you need to install a C compiler (Visual C++ build tools on Windows) and run:

$ pip uninstall -y pandas
$ pip install pandas --verbose --no-cache-dir --no-binary=pandas --global-option="--inplace"

Be sure to install the correct Visual C++ build tools, for example, Python 3.7 requires the 2017 version, while Python 3.4/3.5/3.6 require the 2015 version. Also, make sure you have a recent setuptools version; upgrade if necessary:

$ pip install --upgrade setuptools

It may be wise to copy and store the build log if you encounter any problems after installation, you may get a clue from warnings emitted on build.

Now install pytest and run the tests to validate the installation:

$ pip install pytest
$ python -c "import pandas; pandas.test()"

If the tests fail and you downloaded the wheel from PyPI, open a new issue in pandas' Github repo as the wheel should be supported on your platform, but is isn't. In both other cases (installing third-party wheels or building from source), you're on your own. If you're building from source, ask another question here, providing the full build log.

Incommode answered 7/8, 2018 at 10:6 Comment(3)
I did find the proper wheel to my pip in the link you attached. It is pandas-0.23.4-cp37-cp37m-win_amd64.whl. However I unistalled pandas and then installed the wheel and the exception is still thrown when I try to import pandas and run the program. I'm yet to try the other options (of 3rd party wheels and building from source file).Hushhush
@Hushhush If you found the wheel on PyPI and after reinstalling you still get the same error, I strongly encourage you to open an issue on pandas Github repo. On your machine, installing the official wheel makes pandas unusable, so it's a severe issue to me. Also, keep in mind that Python 3.7 is still in its early days, so errors are likely to occur. You can install Python 3.6 alongside the 3.7, install pandas there (py -3.6 -m pip install pandas) and check whether the import pandas succeeds. If it does, most probably you found a new bug.Incommode
I'd also suggest to run the import line with gdb to get some error stacktrace before filing the issue, but am unsure whether/how one can install and use gdb on Windows.Incommode
D
0

You Probably have not installed the Quandl package properly. Because I've tried it in Juypter Notebook before installation it gives me the same error that you are getting. But after installing the package it works fine. Please see the attached screenshot. Incase of command line installation please type the following command:

pip install quandl

Quandl Installation Link

If it gives the pip installation then first you need to install pip.

Doorkeeper answered 31/7, 2018 at 9:29 Comment(1)
I have installed both pip and Quandl. I tried now to reinstall it, but there's no change. This is not the case.Hushhush
A
0

Well, I use Quandl with Canopy and Anaconda (Windows and Mac) and never had any kind of problem at all. Sorry I did not see that you had already installed.

But on the other hand, I had some troubles using pip when I did not run it as administrator - sometimes it said that the package was installed but it was not.

Anodic answered 1/8, 2018 at 9:51 Comment(0)
Q
0

if you install quandl sucessfully, then check where it installed. Generally, default library resides in

your installed python directory/lib, , in my case C:/Program Files (x86)/Python37-32/lib

and pip installs third party packages into

(your python dir/lib/site-packages, in my case C:/Program Files (x86)/Python37-32/lib/site-packages

you should be able to find quandl packages there, if not then you did not installed it correctly. And if you use pip in a venv(i.e, VirtualEnv- find more about venv at https://docs.python.org/3/tutorial/venv.html and pycharm uses venv by default, you'll find the library in (your project location)/venv/lib/site-packages, which in my case, C:/Users/user/Documents/PyProject1/venv/lib/site-packages, you'll definitely find your quandl packages there too; if not you need to re-install it. Python import mechanism is,

it always tries find modules into your code file home directory, PYTHONPATH, standard library directories, site-packages directory, .pth files, by default. you can see the path by the following command,

import sys
print(sys.path)

then you can check the paths, check for quadl installation dir, if it's not in site-packages as mentioned earlier(which may be an exception and installation fault), update it. check PYTHONPATH in Windows

If you use pycharm then when you create a project, expand the

project Interpreter:new virtual environment, then check inherit global site-packages, then pycharm automatically import third party packages into venv site-packages.

and also you need to install anything using pip with administrator privileges in windows, otherwise pip'll not install packages correctly. Hope this helps

Quinidine answered 7/8, 2018 at 9:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.