pyinstaller ImportError: DLL load failed - only on some PC's

RMRiver

I have created an exe using pyinstaller by running the following command:

pyinstaller app_proto.spec

app_proto.spec is shown below :

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['app_proto.py'],
             pathex=['C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src'],
             binaries=[],
             datas=[('C:/Users/user01/AppData/Local/Programs/Python/Python38/Lib/site-packages/dask/dask.yaml', 'dask' )],
             hiddenimports=['dask'],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='app_proto',
          debug=True,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )


a.datas +=[('./icons/application-export.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\application-export.png','DATA')]
a.datas +=[('./icons/application-import.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\application-import.png','DATA')]
a.datas +=[('./icons/application-wave.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\application-wave.png','DATA')]
a.datas +=[('./icons/arrow-out.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\arrow-out.png','DATA')]
a.datas +=[('./icons/border-bottom-thick.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\border-bottom-thick.png','DATA')]
a.datas +=[('./icons/border-left.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\border-left.png','DATA')]
a.datas +=[('./icons/border-right.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\border-right.png','DATA')]
a.datas +=[('./icons/chart--plus.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\chart--plus.png','DATA')]
a.datas +=[('./icons/desktop.ini','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\desktop.ini','DATA')]
a.datas +=[('./icons/edit-list-rtl.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\edit-list-rtl.png','DATA')]
a.datas +=[('./icons/folder-open-document.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\folder-open-document.png','DATA')]
a.datas +=[('./icons/marker.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\marker.png','DATA')]
a.datas +=[('./icons/minus-circle.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\minus-circle.png','DATA')]
a.datas +=[('./icons/minus.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\minus.png','DATA')]
a.datas +=[('./icons/report-word.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\report-word.png','DATA')]
a.datas +=[('./icons/script-attribute-y.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\script-attribute-y.png','DATA')]
a.datas +=[('./icons/system-monitor.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\system-monitor.png','DATA')]

coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               upx_exclude=[],
               name='app_proto')

On some PCs when running the exe using --onedir mode with debug enabled the following output is presented:

[2020] LOADER: Running pyi_rth_mplconfig.py
[2020] LOADER: Running pyi_rth_mpldata.py
[2020] LOADER: Running pyi_rth_pyqt5.py
[2020] LOADER: Running app_proto.py
Traceback (most recent call last):
  File "src\app_proto.py", line 7, in <module>
  File "c:\users\user01\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
  File "src\pyinstallerimports\__init__.py", line 1, in <module>
  File "c:\users\user01\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
  File "site-packages\cchardet\__init__.py", line 1, in <module>
ImportError: DLL load failed while importing _cchardet: The specified module could not be found.
[2020] Failed to execute script app_proto
[2020] LOADER: OK.
[2020] LOADER: Cleaning up Python interpreter.

As mentioned in the question the exe works on a handful of PCs (some that have never had python on before - if that matters).
Within the directory of the exe there is a folder named cchardet with the .pyd file _cchardet

Does anyone know how to fix this?

Prakhar

I had the same error with cchardet while using Python 3.7. Updating Visual C++ solved this for me. Try these steps -

  1. download x64: vc_redist.x64.exe from https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
  2. Install it.
  3. Restart your computer

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Pyinstaller ImportError with scipy: DLL load failed

From Dev

"ImportError: DLL load failed while importing" while using PyInstaller

From Dev

Pyinstaller ImportError: DLL load failed: The specified module could not be found

From Dev

Pyinstaller ImportError : DLL load failed while importing win32gui

From Java

ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

From Dev

How to resolve "ImportError: DLL load failed:" on Python?

From Dev

sklearn. ImportError: DLL load failed

From Dev

"ImportError: DLL load failed" when importing tensorflow

From Dev

"ImportError: DLL load failed" in PyCharm w/ conda: how to automatically import conda's PATH?

From Dev

Pyinstaller: Import Error: DLL load failed: The specified module could not be found

From Dev

ImportError: DLL load failed: The specified module could not be found for numpy

From Dev

pyodbc ImportError: DLL load failed: The specified module could > not be found

From Dev

paramiko ImportError: DLL load failed: The operating system cannot run %1

From Python

ImportError: DLL load failed: The file cannot be accessed by the system

From Dev

ImportError: DLL load failed: The file cannot be accessed by the system

From Python

ImportError: DLL load failed with pybind11 and PCL

From Dev

Tensorflow installation issue: ImportError: DLL load failed with error code -1073741795

From Dev

Python: ImportError: DLL load failed: The specified module could not be found

From Dev

"ImportError: DLL load failed while importing _openmp_helpers"?

From Java

ImportError: DLL load failed: The specified module could not be found

From Java

ImportError: DLL load failed: The specified module could not be found

From Dev

Pyjnius. ImportError: DLL load failed: The specified module was not found

From Dev

NLTK ImportError: DLL load failed: The specified module could not be found

From Dev

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

From Dev

Scipy ImportError: DLL load failed: The specified module could not be found

From Dev

Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found

From Dev

importError: DLL load failed(import h5py)

From Dev

skimage - ImportError: DLL load failed: The specified module could not be found

From Dev

Tensorflow: ImportError: DLL load failed: Cannot find module

Related Related

  1. 1

    Pyinstaller ImportError with scipy: DLL load failed

  2. 2

    "ImportError: DLL load failed while importing" while using PyInstaller

  3. 3

    Pyinstaller ImportError: DLL load failed: The specified module could not be found

  4. 4

    Pyinstaller ImportError : DLL load failed while importing win32gui

  5. 5

    ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

  6. 6

    How to resolve "ImportError: DLL load failed:" on Python?

  7. 7

    sklearn. ImportError: DLL load failed

  8. 8

    "ImportError: DLL load failed" when importing tensorflow

  9. 9

    "ImportError: DLL load failed" in PyCharm w/ conda: how to automatically import conda's PATH?

  10. 10

    Pyinstaller: Import Error: DLL load failed: The specified module could not be found

  11. 11

    ImportError: DLL load failed: The specified module could not be found for numpy

  12. 12

    pyodbc ImportError: DLL load failed: The specified module could > not be found

  13. 13

    paramiko ImportError: DLL load failed: The operating system cannot run %1

  14. 14

    ImportError: DLL load failed: The file cannot be accessed by the system

  15. 15

    ImportError: DLL load failed: The file cannot be accessed by the system

  16. 16

    ImportError: DLL load failed with pybind11 and PCL

  17. 17

    Tensorflow installation issue: ImportError: DLL load failed with error code -1073741795

  18. 18

    Python: ImportError: DLL load failed: The specified module could not be found

  19. 19

    "ImportError: DLL load failed while importing _openmp_helpers"?

  20. 20

    ImportError: DLL load failed: The specified module could not be found

  21. 21

    ImportError: DLL load failed: The specified module could not be found

  22. 22

    Pyjnius. ImportError: DLL load failed: The specified module was not found

  23. 23

    NLTK ImportError: DLL load failed: The specified module could not be found

  24. 24

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

  25. 25

    Scipy ImportError: DLL load failed: The specified module could not be found

  26. 26

    Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found

  27. 27

    importError: DLL load failed(import h5py)

  28. 28

    skimage - ImportError: DLL load failed: The specified module could not be found

  29. 29

    Tensorflow: ImportError: DLL load failed: Cannot find module

HotTag

Archive