Pycharm fails to import numpy and snappy using anaconda environment
I am trying to work with the PyCharm Community Edition 2018.2.4 and Anaconda3.5 with Python3.7 (on Windows10). I set the Project Interpreter Path to the python.exe in the anaconda environment I want to use and I see all the packages I installed for that environment in the Project Interpreter UI.
However, when I try to import either numpy or snappy through the Python Console, I get an import error.
For numpy the error states:
"Traceback (most recent call last):
[...]
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found."
For snappy the error states:
"Traceback (most recent call last):
[...]
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
[...]
ModuleNotFoundError: No module named 'snappy._snappy_cffi'"
I am quite new to Python and PyCharm in particular and have no idea whether these issues are related. I had no troubles importing other modules from the same environment like json, cython, six,... in PyCharm. I tried importing both modules (numpy and snappy) through the conda prompt and Spyder and it worked just fine there. I also reinstalled Anaconda and set up the dedicated conda environment again, but the problem in PyCharm persists.
Any help will be very much appreciated!
Please sign in to leave a comment.
Hi Nila,
Do I correctly understand that you have tried to import modules outside of PyCharm for the same interpreter and succeeded?
Could you please check that the same interpreter is used in `File | Settings | Build, Execution, Deployment | Console | Python Console`?
Hi Sergey,
Yes, I was using the same interpreter in both Spyder and the conda prompt and the import worked without error.
And yes, the interpreter used by the Python Console is the same.
We had a similar issue https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001194720.
Please upload your logs folder zipped (Help | Show Log in...) after reproducing the problem to https://uploads.services.jetbrains.com/ and let us know the name of the zip file. Please also include a screenshot of Project Interpreter window in the zip file.
Dear Sergey,
Thanks a lot for your help. The zip folder is called: 181017_PyCharmLog_NumpySnappy_ImportFailure_NM.zip
Thanks for the log.
It seams to be https://youtrack.jetbrains.com/issue/PY-27234, please vote for it in order to increase priority and follow for future updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
Thanks