ImportError: DLL load failed: The specified procedure could not be found.

Completed

Hello, 

I'm using PyCharm for my python projects. When trying to import the cvxopt library I get the below error when running the code from the GUI. Everything is fine when doing so via the terminal.

import cvxopt as opt

D:\Programs\Anaconda\envs\env_zipline\python.exe D:/Programs/Anaconda/envs/env_zipline/code/portfolio-optimization/test.py
Traceback (most recent call last):


File "D:/Programs/Anaconda/envs/env_zipline/code/portfolio-optimization/test.py", line 1, in<module>
import cvxopt as opt
File "D:\Programs\Anaconda\envs\env_zipline\lib\site-packages\cvxopt\__init__.py", line 32, in <module>
import cvxopt.base
ImportError: DLL load failed: The specified module could not be found.

I compared the terminal PATH with the one used in the GUI and there where some differences. Among the below list only the first one was used by run/debug command. Nonetheless when forcing it in the system's PATH I still get the same error.  

D:\Programs\Anaconda\envs\env_zipline\Library\bin;
D:\Programs\Anaconda\envs\env_zipline;
D:\Programs\Anaconda\envs\env_zipline\Library\mingw-w64\bin;
D:\Programs\Anaconda\envs\env_zipline\Library\usr\bin;
D:\Programs\Anaconda\envs\env_zipline\Library\bin;
D:\Programs\Anaconda\envs\env_zipline\Scripts;

Note that I'm using Anaconda envs and these are well defined in the interpreter of both the project and the debug. Other libraries seem to work fine. But this doesn't explain the difference between the terminal and the GUI launch.

Any hint what could cause such error?

 

2 comments

Hi,

It's a known problem https://youtrack.jetbrains.com/issue/PY-27234.

Please try the following:

- run print(os.environ['PATH']) in the system terminal using the same interpreter

- copy the result and add as PATH environment variable to your Run/Debug Configuration

- do the same for Python Console settings to get it working too.

2

Hi, 

Indeed it helped.

Thank you!

0

Please sign in to leave a comment.