Python ImportError: DLL load failed: The specified module could not be found on fman build system (fbs)

1.4k Views Asked by At

I encountered error when i am trying to convert my python scripts to EXE using fman build system (fbs). This error happened when i tried to run the program on Python 3.6 in cmd in virtual environment.

I am using Python 3.6 and pyinstaller 3.4. Below are the list of library im using.

altgraph (0.17)
cycler (0.10.0)
fbs (0.8.4)
future (0.18.2)
joblib (0.14.1)
kiwisolver (1.1.0)
macholib (1.14)
matplotlib (3.1.2)
numpy (1.18.1)
opencv-contrib-python (4.1.2.30)
opencv-python (4.1.2.30)
pefile (2019.4.18)
pip (9.0.1)
PyInstaller (3.4)
pyparsing (2.4.6)
PyQt5 (5.9.2)
python-dateutil (2.8.1)
pywin32-ctypes (0.2.0)
scikit-learn (0.22.1)
scipy (1.4.1)
setuptools (39.1.0)
sip (4.19.8)
six (1.14.0)
webcolors (1.10)

Below are the error i received:

(venv) D:\Skripsi\ColorHarmonization-master\target\ColorHarmonization>ColorHarmonization.exe
d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py:627: MatplotlibDeprecationWarning:
The MATPLOTLIBDATA environment variable was deprecated in Matplotlib 3.1 and will be removed in 3.3.
  exec(bytecode, module.__dict__)
Traceback (most recent call last):
  File "main.py", line 7, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "util.py", line 8, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\sklearn\__init__.py", line 82, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\sklearn\base.py", line 20, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\sklearn\utils\__init__.py", line 27, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\stats\__init__.py", line 384, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\stats\stats.py", line 179, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\spatial\__init__.py", line 102, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\spatial\_procrustes.py", line 11, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\linalg\__init__.py", line 195, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
  File "d:\skripsi\colorharmonization-master\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "lib\site-packages\scipy\linalg\blas.py", line 215, in <module>
ImportError: DLL load failed: The specified module could not be found.
[14240] Failed to execute script main
2

There are 2 best solutions below

0
On

My answer on this thread might be of help to include various resources upon fbs freeze.

In your case you can check lib\site-packages\scipy\linalg\blas.py", line 215 to see which .dll is being referenced.

The 'google-api-python-client' distribution was not found and is required by the application with pyinstaller

0
On

With PyInstaller 3.4, it's possible that some dynamic libraries for scipy are not properly loaded because their locations have changed to a different directory, i.e. under site-packages/scipy/.libs

You need to edit PyInstaller/hooks/hook-scipy.py file so the libraries are search under site-packages/scipy/.libs

The fix can be found here and you can get the latest file from github

You may also have to edit PyInstaller/hooks/hook-numpy.py if your application depends on the numpy module too