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

Answered

 This is similar but different to the other DLL load failed issues.

When I run PyCharm and try to import a library as follows

from PyQt5.Qt3DCore import QEntity
Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm 2017.1.7\helpers\pydev\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm 2017.1.7\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified procedure could not be found.

Yet when I run the command form a python console (started within PyCharm) I get no errors.

If I run Python in a command window it also works!

I've been pulling my hair out on this one.

Does anyone know how the module loader is searching for the DLLs? An which DLLs is it searching for?

Why does the python console work but neither the debugger nor the running program works within PyCharm! 

 

0
11 comments

Would you kindly try 2019.1 EAP build? At least DLL error should be fixed there if you are using conda.

1

Which interpreter do you use and how it was created? Try switching Settings | Build, Execution, Deployment | Python Debugger | PyQt compatible option.

1

Hi Pat, could you please check import os; print(os.environ['PATH']) in the console and in run/debug? Are there any differences?

0

Could you please enable Settings | Tools | Python Scientific | Show plots in toolwindow option? Has it helped to prevent an exception?

0

 I had a similar problem which I resolved actually by turning off Settings | Tools | Python Scientific | Show plots in toolwindow

0

The corresponding ticket in the bug tracker for future references: PY-27234.

0

@pavel karateev I installed tensorflow in pycharm (i went to settings,project interpreter and clicked on the plus sign) after installing tensor flow,I can't import it but I can import numpy. I get some errors that says "dll load failed" and "failed to load the native tensorflow runtime". Please what do i need to do. Note: i did not install anaconda in my pc.

0

I get a similar error when running in debug mode, but not in release mode in PyCharm 2019.2

import os
print(os.environ['PATH'])
from PyQt5 import QtGui

Runs fine with "Run" from PyCharm, but fails with "Debug".

>>> from PyQt5 import QtGui
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: DLL load failed: The specified procedure could not be found.

 

The key difference is the path in the debug case is prepended with "C:\Python36\lib\site-packages\PySide2"

The problem comes from trying to use PySide2 and PyQt5 at the same time. But why is debug mode trying to use PySide2?

I can't find any Settings | Tools | Python Scientific | Show plots in toolwindow setting for me to adjust.

I certainly would prefer to be able to debug my code.

 

0

Hi all, 

I am having the same problem as @Cmbruns - I can import the package in powershell (using py) and I can also "Run" it in PyCharm, but I get the DLL load failed error when trying to debug.

Any help on this as I can't move on with my project? 

0

I was using the original existing interpreter from AppData, no virtualenv. Also, I didn't have the problem with PyQt, but with my company's package - I forgot to specify that. 

However, I have already "resolved" the problem by uninstalling Python and Pycharm and installing them again along with the packages :shrug:

Thank you. 

0

In the short term, I resolved my problem by uninstalling pyside "pip uninstall PySide2". However that setting mentioned by Pavel Karateev, Settings | Build, Execution, Deployment | Python Debugger | PyQt compatible looks like exactly the correct way to handle this. I will likely be reinstalling PySide2 one day soon, and I will use that Setting to control this in the future. Pro tip: The quick way to find that setting is to type "pyqt" in the settings search box.

Thank you.

 

0

Please sign in to leave a comment.