Failed to load python DLL module in PyCharm. Works fine in IPython

When I use IPython, which is part of the Enthought Python Distribution, I can import the pyvision package just fine. However, when I try to import pyvision inside PyCharm 1.2.1, I get the following errors:

File "C:\Python27\lib\site-packages\pyvision\__init__.py", line 146, in <module> from pyvision.types.img import Image,OpenCVToNumpy,NumpyToOpenCV File "C:\Python27\lib\site-packages\pyvision\types\img.py", line 43, in <module> import numpy File "C:\Python27\lib\site-packages\numpy\__init__.py", line 142, in <module> import add_newdocs File "C:\Python27\lib\site-packages\numpy\add_newdocs.py", line 9, in <module> from numpy.lib import add_newdoc File "C:\Python27\lib\site-packages\numpy\lib\__init__.py", line 13, in <module> from polynomial import * File "C:\Python27\lib\site-packages\numpy\lib\polynomial.py", line 17, in <module> from numpy.linalg import eigvals, lstsq File "C:\Python27\lib\site-packages\numpy\linalg\__init__.py", line 48, in <module> from linalg import * File "C:\Python27\lib\site-packages\numpy\linalg\linalg.py", line 23, in <module> from numpy.linalg import lapack_lite ImportError: DLL load failed: The specified module could not be found. 

Am I missing some path settings in Windows?

+5
source share
7 answers

I had the same problem. I am using Winpython32 and trying to import win32com . Worked everywhere (I tried) except PyCharm. sys.path and os.environ['PYTHONPATH'] had some additional entries inside Pycharm, but nothing was missing compared to when they ran elsewhere.

The solution was to run Pycharm in the Winpython console and not use the shortcut.

sys.path and os.environ['PYTHONPATH'] not changed. os.environ['PATH'] several additional entries were added, all related to the python installation. At the moment, I suspect that this is due to "non-standard" installations. Winpython32 tries to be "portable", and other messages of similar problems when using Enthought or Python (x, y).

Manually adding:

  C:\WinPython-32\python-2.7.6\ C:\WinPython-32\python-2.7.6\DLLs C:\WinPython-32\python-2.7.6\Scripts 

to the system path (the global PATH environment variable in Windows) solved the problem without having to run Pycharm on the Winpython command line. Note: C:\WinPython-32\python-2.7.6\Scripts alone did not solve.

+4
source

I had this problem before and it seems to be fixed by Enthought fix.

EDIT: I just checked, one of my f2py projects still suffered from this exact error. Enthought repair did not work. The solution to my problem was actually fixing the Windows path variable. You need to make sure c: \ Python27 \ Scripts (or your equivalent) is on the way. In addition, and this is VERY important, make sure that each entry in the global variables and environment variables of the user path does not have a slash. This destroys the GNU make utility on Windows.

+1
source

Add PATH to your environment variable

 C:\Python27 C:\Python27\DLLs C:\Python27\Scripts 
+1
source

This is a pretty nasty bug in PyCharm. Even if you configure your virtualenv from PyCharm, the python console uses system python by default. When you installed PyCharm, presumably you used the win32 pin code on a 64-bit machine.

Go to file>settings>Build, Execution, Deployment>Console>Python Console and change the Python Interpreter from the system version to your virtualenv.

Of course, PyCharm does not immediately update it. You need to close the project and reopen it.

To verify that this was successful, open the Python console ( Tools>Python Console ) and check the very first line of output: it should point to python.exe your virtual environment, and not to system python.

+1
source

I have the same problem (with a different package) and I do not want to change the path to Windows. I could solve this very roughly in the pycharm console by creating a python script that updates sys.path and os.environ ['PATH'] in the file -settings-console-pathon console - starting with the script. It only works when I use the "tools-python shell"

However, it does not work in startup options. I even tried to create a virtual environment, add the path to activ.bat, but in pycharm it does not work (from the command line it does) (as suggested in virtualenv, which can find relocated libraires (for example, mysqlclient lib for MySQLdb) ) I explain the path defined in python interpreter but it does not work (as suggested in fooobar.com/questions/202219 / ... )

0
source

enter image description here I could not find the link, but I saved this picture - I hope it suits you

0
source

I apologize for the fact that my explanation was long and probably not the best of clarity, but this is the best I could do to describe my experience.

I had the same problem after the first installation, and here is how I solved it:

I noticed that there are some settings, as indicated in other answers that tell pyCharm which interpreters and environment managers should use, and I was sure that the problem was in setting these parameters, but I was not sure how, so I started Search.

Translator Setup

I more or less followed the standard guide, assuming that at some point I was using the newly created virtualenv inside my project folder. At first I received a DLL error, but when I made sure that the interpreter settings point to a valid executable.

It explains how to do this.

Environment setup

At this point, the error disappeared, but I moved on to a new error. The problem is that I could not import any module, since they were not found. This is because I was working inside the newly created virtualenv, basically an untouched installation, with no modules installed. I'm sure there are more advanced solutions (install modules in virtualenv), but I was just looking to make the code work, so I set up the environment to use my usual anaconda development environment.

For me, with conda on windows (after activating the development environment with conda activate ) then (see .... / anaconda-python-where-are-the-virtual-environment-stored for other systems). where python gives the path to the interpreter, conda info --envs gives me the existing environment that I want to use.

It fixed everything for me.

0
source

All Articles