Pyinstaller ImportError: no module named pkg_resources

I am trying to pack my Python script using Pyinstaller. My script imports third-party Exscript and Netaddr modules. I get the error below when I try to run the executable generated by Pyinstaller.

I know that "pkg_resources" refers to setuptools, but I checked, and I have setuptools 18.2 in site packages, and I see that it is easily installed in the script directory. I am running Python 2.7.

Any help on getting Pyinstaller is welcome. FYI, I searched and reviewed similar issues here, and they did not apply to this particular problem.

Here is the result of running Pyinstaller (I only included errors):

C:\Python27\Lib\PyInstaller-2.1>pyinstaller c:\users\<username>\pycharmprojects\neworking2\network_login.py
5759 INFO: building because out00-Tree.toc missing or bad
5983 INFO: building because out01-Tree.toc missing or bad
7097 INFO: rebuilding out00-PYZ.toc because out00-PYZ.pyz is missing
9569 INFO: rebuilding out00-PKG.toc because out00-PKG.pkg is missing
9591 INFO: rebuilding out00-EXE.toc because network_login.exe missing

The result of the .exe generated by Pyinstaller:

 C:\Python27\Lib\PyInstaller-2.1\network_login\dist\network_login>network_loginTraceback (most recent call last):
File "build\bdist.win32\egg\paramiko\__init__.py", line 30, in <module>
File "build\bdist.win32\egg\paramiko\transport.py", line 49, in <module>
File "build\bdist.win32\egg\paramiko\dsskey.py", line 26, in <module>
File "build\bdist.win32\egg\Crypto\PublicKey\DSA.py", line 89, in <module>
File "build\bdist.win32\egg\Crypto\Random\__init__.py", line 28, in <module>
File "build\bdist.win32\egg\Crypto\Random\OSRNG\__init__.py", line 34, in <module>
File "build\bdist.win32\egg\Crypto\Random\OSRNG\nt.py", line 28, in <module>
File "build\bdist.win32\egg\Crypto\Random\OSRNG\winrandom.py", line 7, in <module>
File "build\bdist.win32\egg\Crypto\Random\OSRNG\winrandom.py", line 3, in __bootstrap__ImportError: No module named pkg_resources
+4
1

script apscheduler, :

Traceback (most recent call last):
...
    File "d:\Anaconda\lib\site-packages\apscheduler\schedulers\base.py", line 9, in <module>
      from pkg_resources import iter_entry_points
ImportError: No module named pkg_resources
scheduler2 returned -1

, pyinstaller setuptools *.egg, .

- setuptools *.egg python lib (PYTHON_INSTALL_PATH\lib\site-packages\setuptools *.egg) script pyinstaller.

D:\Anaconda\lib\site-packages\setuptools-18.4-py2.7.egg py script, setuptools-18.4-py2.7. zip ( setuptools-18.4-py2.7) py script.

+1

Source: https://habr.com/ru/post/1607909/


All Articles