Search code examples
pythonpython-3.xpyinstallermsgpack

How to resolve ModuleNotFoundError: No module named 'srsly.msgpack.util' in PyInstaller?


I am trying to convert a python script to .exe using PyInstaller. The script is converted to an exe without any error logs.

However while running the .exe file am getting ModuleNotFoundError: No module named 'srsly.msgpack.util'

The issue is occurring while opening the exe files generated both by PyInstaller and cx_Freeze. The Screenshot of the error is attached here.

Have tried updating, un-install and re-installing of packages, but still the issue persists.

Versions:

  • Python : 3.7
  • OS : Windows 10
  • cx_Freeze : 6.0
  • msgpack : 0.6.2
  • PyInstaller : 3.5
  • srsly : 0.1.0

Solution

  • When PyInstaller evaluated your script, it did not predict the dependency on srsly.msgpack.util. You can manually specify dependencies using --hiddenimport.

        pyinstaller --hiddenimport srsly.msgpack.util your_script.py
    

    You may find that fixing this problem just reveals another. You can add as many --hiddenimport hints as you need.