Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pyinstaller "Failed to execute script pyi_rth_pkgres" and missing packages

This is my first time posting a question here as most of my questions have already been answered by someone else! I am working on a GUI application in python and am attempting to use pyinstaller to package it into a single folder and .exe for easier portability. Currently, I am using windows 10 and anaconda3 to manage my python packages. The application relies on tkinter, pillow, numpy, scikit-learn, opencv, ffmpeg, and matplotlib. The application is formatted with a main GUI.py file that creates objects of a number of other files (many of which are stored in a subfolder as this GUI is replacing a command line utility that served the same purpose). The issue I am running into (as you can see in the title) is that the .exe is throwing the error block:

Traceback (most recent call last): File "site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in File "c:\users\gurnben\anaconda3\envs\opencv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module exec(bytecode, module.dict) File "site-packages\setuptools-20.7.0-py3.5.egg\pkg_resources__init__.py", line 68, in File "site-packages\setuptools-20.7.0-py3.5.egg\pkg_resources\extern__init__.py", line 60, in load_module ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution. Failed to execute script pyi_rth_pkgres

When I look at the warn.txt it gives a massive list of missing packages including parts of some packages that are actually in the single folder package.
I have, however, successfully gotten it to recognize the dll files from opencv and it is not listed among the missing (nor is ffmpeg however I did not see any ffmpeg files in the folder). I had to pass in a custom path to get it to include the opencv files as they are not in anaconda at this time.

Any hints or ideas for next troubleshooting steps? I am overly greatful for all of the help you an offer and I can upload any code, files, etc. that would help you diagnose the issue. In the meantime I will continue searching for a solution myself!

like image 897
gurnben Avatar asked Jun 14 '16 14:06

gurnben


1 Answers

same problem here:

  • OS: Win10
  • Python: 3.7
    • pyinstaller installed by pip install pyinstaller

fix by (same solution with above, by no need download):

pip uninstall pyinstaller pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip 
like image 71
crifan Avatar answered Sep 30 '22 07:09

crifan