ImportError: DLL load failed while importing xxx: The specified program could not be found.

Error Message:

Connected to pydev debugger (build 203.7717.81)
======================================================================
Error when loading pyOpenMS libraries!
Libraries could not be found / could not be loaded.
Note: when using the Spyder IDE, this error may be triggered when
the 'Automatic' backend is used. Please change this in Tools ->
Preferences -> IPython -> Graphics to 'Inline'.
To debug this error, please run ldd (on linux) or dependency walker (on windows) on 
C:\ProgramData\Anaconda3\envs\dgl\lib\site-packages\pyopenms\pyopenms.so
======================================================================
======================================================================
python-BaseException
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\ProgramData\Anaconda3\envs\dgl\lib\site-packages\pyopenms\__init__.py", line 80, in <module>
    raise e
  File "C:\ProgramData\Anaconda3\envs\dgl\lib\site-packages\pyopenms\__init__.py", line 43, in <module>
    from .all_modules import *
  File "C:\ProgramData\Anaconda3\envs\dgl\lib\site-packages\pyopenms\all_modules.py", line 1, in <module>
    from .pyopenms_1 import *
ImportError: DLL load failed while importing pyopenms_1: The specified program could not be found.

 

Analyze the causes
https://github.com/OpenMS/OpenMS/issues/4291#issuecomment-1221604911

A library like pyopenms has a self-contained version of pyqt by itself, so if you do an import of another graphical GUI library before importing this library, you will get an error. So some people put import pyopenms in front of import matplotlib.pyplot as plt just fine

For some code tools (such as Pycharm, etc.), the problem is caused by the automatic import of GUI libraries during debug in order to facilitate debugging.

The problem is that different versions of the same library are loaded. Therefore, you just need to make sure that you don’t accidentally provide multiple Qt versions. Unfortunately, this is a bit difficult on Windows, since you don’t have a proper package manager and each PythonWheel is bound to its own private version.

 

Solution:
Find PyQt compatible in the settings and uncheck https://github.com/OpenMS/OpenMS/issues/4110#issuecomment-578613842

  • File | Settings | Build execution and deployment | Python debugger | PyQtCompatible = Unchecked

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *