Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 455
Alon Avatar asked Jul 28 '18 16:07

Alon


1 Answers

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.

like image 75
hoefling Avatar answered Oct 17 '22 06:10

hoefling