0

I am trying to make an executebale out of a .py script I have, in a virtual environment with pyinstaller. however after making my executeable with pyinstaller --onefile myprogram.py when running the resulting myprogram.exe from command prompt, I get this error:

Traceback (most recent call last):
  File "myprogram.py", line 4, in <module>
  File "Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 395, in load_module
  File "site-packages\IPython\__init__.py", line 48, in <module>
  File "Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 395, in load_module
  File "site-packages\IPython\core\application.py", line 23, in <module>
  File "Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 395, in load_module
  File "site-packages\traitlets\config\__init__.py", line 6, in <module>
  File "Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 395, in load_module
  File "site-packages\traitlets\config\application.py", line 17, in <module>
ImportError: No module named decorator

decorator is installed in the env I'm working in so that is not the problem (python 2.7.17, pyinstaller 3.5, windows 10, anaconda) thanks in advance!

  • 1
    Oh, why are you still using Python 2.7? – mechanical_meat Nov 18 '21 at 18:55
  • Have you specified the path to `decorator` as shown in this example: https://stackoverflow.com/a/54645519/42346? – mechanical_meat Nov 18 '21 at 18:56
  • I just tried this and it didn't fix it (and python 2.7 is kind of a thing with this project. I inherited it, not much to do with that) – throughalfanoir Nov 18 '21 at 19:31
  • 1
    python wasn't created to build .exe file - so tools like PyInstaller sometimes have problem to find all needed Python modules and C/C++ libraries. And it creates file `.spec` so you can add manually pathes for modules/libraries/resources. Read PyInstaller documentation for details. There are pages with titles like `Using Spec File` and `What to do when something goes wrong` – furas Nov 18 '21 at 20:09
  • I have manually added the `C:\Users\Me\anaconda3\envs\myenv\Libs\site-packages` to the spec file under pathex, but it still seems to be missing decorator after rebuilding. myenv does have it.... – throughalfanoir Nov 19 '21 at 08:50

0 Answers0