3

I am trying to execute PyInstaller on a my script. I installed all of the required packages and the .exe is succesfully created.

But when I execute it on another machine, I get he Following error:

[2837] LOADER: Running pyi_rth_glib.py
[2837] LOADER: Running pyi_rth_pkgres.py
[2837] LOADER: Running pyi_rth_multiprocessing.py
[2837] LOADER: Running physiocap_templatized.py
Traceback (most recent call last):
  File "physiocap_templatized.py", line 53, in <module>
  File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module
  File "geopandas/__init__.py", line 9, in <module>
  File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 395, in load_module
  File "geopandas/datasets/__init__.py", line 7, in <module>
StopIteration
[2837] Failed to execute script physiocap_templatized
[2837] LOADER: OK.
[2837] LOADER: Cleaning up Python interpreter.
[2836] LOADER: Restoring signal handlers
[2836] LOADER: freeing args
[2836] LOADER: returning child exit status 255
[2836] LOADER: Back to parent (RC: 255)
[2836] LOADER: Doing cleanup
[2836] LOADER: Freeing archive status for /root/MyExe/physiocap_AB_templatized

I tried this but it didn't help. This is the list of packages I installed on the machine that executes PyInstaller: pip freeze:

aenum==2.1.2
altgraph==0.16.1
asn1crypto==0.24.0
astroid==1.6.6
attrs==19.1.0
backports.functools-lru-cache==1.5
backports.ssl-match-hostname==3.5.0.1
cffi==1.12.3
Click==7.0
click-plugins==1.1.1
cligj==0.5.0
configobj==4.7.2
configparser==3.7.4
configshell-fb==1.1.23
contextlib2==0.5.5
coverage==3.6b3
cryptography==2.7
cycler==0.10.0
Cython==0.29.10
decorator==3.4.0
descartes==1.1.0
di==0.0.1
dis3==0.1.2
dnspython==1.12.0
enum==0.4.7
enum34==1.1.6
ez-setup==0.9
Fiona==1.7.11.post1
future==0.17.1
futures==3.1.1
GDAL==1.11.4
geopandas==0.3.0
geopy==1.12.0
idna==2.8
iniparse==0.4
ipaddress==1.0.16
IPy==1.0
Jinja2==2.10.1
jwcrypto==0.2.1
kitchen==1.1.1
kiwisolver==1.0.1
langtable==0.0.45
lazy-object-proxy==1.4.1
macholib==1.11
MarkupSafe==1.1.1
matplotlib==2.2.4
mplleaflet==0.0.5
munch==2.3.2
nose==1.3.7
numpy==1.12.0
pandas==0.22.0
pefile==2019.4.18
perf==0.1
pyasn1==0.4.5
pyasn1-modules==0.2.5
pycparser==2.19
pycurl==7.19.0
pygobject==3.22.0
pygpgme==0.3
PyInstaller==3.4
pyliblzma==0.5.3
pyparsing==2.4.0
pyproj==1.9.5.1
pyshp==2.1.0
python-augeas==0.5.0
python-dateutil==2.8.0
python-linux-procfs==0.4.9
pytz==2019.1
pyudev==0.15
pyxattr==0.5.1
schedutils==0.4
schema==0.7.0
scikit-learn==0.19.1
scipy==0.16.0
Shapely==1.6.4.post2
simplekml==1.3.1
singledispatch==3.4.0.3
six==1.12.0
slip==0.4.0
slip.dbus==0.4.0
subprocess32==3.5.4
urlgrabber==3.10
wrapt==1.11.2
yum-metadata-parser==1.1.4

I am on Centos7 machine with Python2.7.5 and PyInstaller3.4.

Thank you.

2 Answers 2

2

Did you try this answer's solution ? :

I don't use the geopandas datasets in my project/s so instead of manually including them in my .spec file I just commented out the import geopandas.datasets statement from: File "site-packages\geopandas\__init__.py", line 9, in <module>.

It kind of worked for me - I did stop having this Stop Iteration error. Instead I got another error (in my case it's a CRS Error) but this one seems to be more easily solvable.

Anyway, there are definitely compatibility issues between pyinstaller and geopandas linked to its dependencies (pyproj, fiona...) so I think if you get more errors, it's also worth checking the import of each of these modules separately.

2
  • 1
    It did work! I now have a different error (core dump) but at least I no longer have a StopIteration one. Thank you!
    – Haha
    Jul 30, 2019 at 10:58
  • For me, I change the file init like this: Original Code: all = ["available", "get_path"] _module_path = os.path.dirname(file) _available_dir = [p for p in next(os.walk(_module_path))[1] if not p.startswith("")] _available_zip = {"nybb": "nybb_16a.zip"} available = _available_dir + list(_available_zip.keys()) __all = ["available", "get_path"] Code after changes: _module_path = os.path.dirname(file) _available_zip = {"nybb": "nybb_16a.zip"} available = list(_available_zip.keys())
    – MeBex
    Apr 4, 2022 at 21:54
0

For me worked to comment on this line on my virtual environment:

## geopandas\__ init__. Py line 17 code “import geopandas. Datasets # noqa” 

Then I run again pyinstaller and the EXE worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.