Tag Archives: importerror

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

Finally solved the importError: DLLload failed: the specified module could not be found when import matplotlib.pyplot

After all the dependent libraries in Matplotlib (dependent library details: click the open link) were installed successfully, import matplotlib succeeded, but the following error occurred when importing matplotlib.pyplot as PLT:
ImportError: DLLload failed: the specified module
cannot be found
Then I found that the size of matplotlib I installed was 8128 KB, and the same version of Matplotlib I found from another address was 8503 KB. Finally, I uninstalled and reinstalled matplotlib of 8503KB and introduced Matplotlib. pyplot successfully.
J presented here introduced successful version of the download address: https://pypi.org/project/matplotlib/#files
Use administrator privileges to perform the following uninstall:
pip uninstall matplotlib
Reinstall after uninstalling:
pip install matplotlib
Close test effectively
Dependency library installation example:


Matplotlib was installed successfully: