Reputation: 467
I have a gui that I created with wx and a bunch of other libraries like matlabplot, win32api etc...
I have compiled the python code into an executable using py2exe.
The executable gets created but when I try to run it, it produces an error.
Traceback (most recent call last):
File "gui.py", line 30, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "guiupdater.pyc", line 22, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "paramiko\__init__.pyc", line 30, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "paramiko\transport.pyc", line 32, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "cryptography\hazmat\backends\__init__.pyc", line 7, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "pkg_resources\__init__.pyc", line 70, in <module>
File "pkg_resources\extern\__init__.pyc", line 61, in load_module
ImportError: The 'appdirs' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
I had previously compiled the executable and had it running in a different environment. I'm on a new environment now, but I have all the same dependencies installed etc...
I did some quick research and lots of people say reverting their setuptools to 19.2 version fixed it for them but I am relunctent to do that because my setuptools is at version 28.2. I feel like it would do more harm than good...
Does anyone know how to fix this error?
Upvotes: 2
Views: 1307
Reputation: 3217
It's an issue introduced with newer versions of setuptools. Either:
add 'pkg_resources' to setuptools.setup packages option
or
Downgrade to version 19.2
pip install setuptools==19.2
Upvotes: 0
Reputation: 11
I had the same problem and as I did not want to go far back with versions I had to do some research...
Problem is that while processing pkg_resources.extern
all necessary modules from (private?) default package pkg_resources._vendor
are not found (delayed load).
Compare contents of pkg_resources._vendor
at source (site-packages) and inside library.zip that is generated with executable. Whatever is missing in zip can be included by options
for py2exe
.
options={"py2exe": {"includes": ["pkg_resources._vendor.appdirs",...], ...
Upvotes: 1