3

Im using pyinstaller to make a a .exe from a python script it outputs just fine but I get this error when I try to excecute.

  File "PyInstaller/loader/rthooks/pyi_rth_pkgres.py", line 13, in <module>
  File "/home/arturo/.local/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "pkg_resources/__init__.py", line 86, in <module>
ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
[25405] Failed to execute script pyi_rth_pkgres

I have allready reinstall setuptools.

  • 1
    Relevant [`"Failed to execute script pyi_rth_pkgres"`](https://stackoverflow.com/search?q=%22Failed+to+execute+script+pyi_rth_pkgres%22) – stovfl Feb 10 '20 at 15:09

3 Answers3

10

Thanks for the solution. It works for me on Windows 10/python 3.7.2:

pip uninstall pyinstaller
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip 
Andriy
  • 141
  • 5
4

I found the solution on this post.

Basically, The steps are:

  • Remove PyInstaller pip uninstall pyinstaller.
  • Download the zip from github.
  • Unzip file.
  • Make sure you are in the directory with "setup.py" and run: python setup.py install
  • This doesn't make much sense to me--these are just instructions for uninstalling, and then reinstalling pyinstaller from a development version of GitHub. Can you explain why you believe this to be a solution to the OP's problem? – Iguananaut Feb 10 '20 at 14:49
  • 1
    @Iguananaut I think this can be a solution, because the missing package error is a bug in the production version, just reinstalling with pip doesn't make a difference. Everyone with this same problem install the develop version and work's – Gabriel Rodrigues Segalla Feb 10 '20 at 15:00
  • It didn't work, im not sure if the problem is caused because im trying top read a csv using files from anothger folder. – Arturo Velásquez García Feb 10 '20 at 16:13
  • Ok, that would be worth noting (and linking to the upstream bug report if there is one). but for what it's worth you can pip install a package directly from its source repository, e.g. like `pip install git+https://github.com/pyinstaller/pyinstaller.git`. – Iguananaut Feb 10 '20 at 16:14
0

Add the following argument to your pyinstaller command line:

--hidden-import=pkg_resources.py2_warn

That fixed it me with little problems.

RufusVS
  • 4,008
  • 3
  • 29
  • 40