0

I am trying to generate an executable from a python script using pyinstaller. For this I am executing the following command:

pyinstaller --onefile --paths /path/to/venv/lib/python3.9/site-packages \
   --paths /path/to/venv/lib64/python3.9/site-packagesscript.py

It generates an executable but when trying to execute it, it gives me an error:

OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Not found '_raw_ecb.cpython-39-x86_64-linux-gnu.so', Not found '_raw_ecb.abi3.so', Not found '_raw_ecb.so'

When executing

pyinstaller --onefile myscript.py

on my Windows 10 machine, everything works fine. On my Fedora machine, however, I get thus error.

How can I prevent this from happening?

EDIT

sys.path gives the following result:

['', '/usr/lib64/python39.zip', '/usr/lib64/python3.9', '/usr/lib64/python3.9/lib-dynload', '/home/user/.virtualenvs/venv/lib64/python3.9/site-packages', '/home/user/.virtualenvs/venv/lib/python3.9/site-packages']
WayneNani
  • 173
  • 1
  • 9

1 Answers1

0

It looks like you are missing a cryptographic package. The file it cannot find is provided by python3-pycryptodomex; try sudo dnf install python3-pycryptodomex and see if the problem persists.

EDIT: type python in the console. When you get the three arrows (>>>), type first import sys and hit enter. Then, type sys.path and post the output.

  • I executed the command, but it still gives me the exact same error. – WayneNani Oct 20 '21 at 15:45
  • Please see my updated answer. –  Oct 20 '21 at 17:21
  • I posted the output to the original question. I also tried including all those paths with the `--paths` flag. Unfortunately, it still fails upon execution. – WayneNani Oct 20 '21 at 17:32
  • Sorry I can't be of more help, but I'm sure that package provides the required dependencies. It probably cannot find it due to some linking issues (maybe from inside the virtual environment). –  Oct 22 '21 at 07:08