When my Python application frozen with PyInstaller attempts to import Geopandas, it stops working.
- Windows 10
- PyInstaller 3.3.1
- Geopandas 0.4
Here is the source code:
print("Hello, StackOverflow")
import geopandas as gpd
Here is the resulting console output of the compiled EXE:
Hello, StackOverflow
Traceback (most recent call last):
File "application.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "d:\documents\projecttwo\publish\harv_venv1\env\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\geopandas\__init__.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "d:\documents\projecttwo\publish\harv_venv1\env\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\geopandas\datasets\__init__.py", line 7, in <module>
StopIteration
[6764] Failed to execute script application
This behavior is consistent when I attempt to import Geopandas is much more complex applications, and the console output is constant.
Geopandas is installed correctly within the Python 3.6.3 virtual environment (through PIP, I've tried versions 0.4 and 0.3 as well) and works just fine prior to compilation (ie. python application.py
runs successfully).
I have attempted installing both geopandas and pyinstaller from different sources (eg. Gohlke's wheel), with the same results. I have also tried creating an entirely new virtual env from scratch, installing Fiona from Gohlke and geopandas from pip.
I suspect some hidden imports may need to take place. I am fairly new to PyInstaller, so any help would be appreciated.