Article catalog
1. Iteration error of geopandas occurs when executing exe. 2. Fiona cannot be found when executing exe_ Shim3. Cannot find fiona.shema4. Summary by executing exe
First, use pyinstaller – F main.py to package the code into an EXE with a black window. The following are some problems and solutions
1. The iteration error of geopandas occurs when executing exe
The error information is as follows:
(gis_data_process) D:\code\gis_data_processing>main.exe
Traceback (most recent call last):
File "main.py", line 10, in <module>
from gis_data_process import *
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "gis_data_process.py", line 7, in <module>
import geopandas
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "geopandas\__init__.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "geopandas\datasets\__init__.py", line 6, in <module>
StopIteration
[24328] Failed to execute script 'main' due to unhandled exception!
The solution is as follows:
- comment geopandas\__ init__. Py line 17 code “import geopandas. Datasets # noqa” delete the build, dist and spec files generated by packaging and reuse pyinstaller – f main. Py packaging OL>
2. Execute exe and cannot find Fiona_ shim
The error information is as follows:
(gis_data_process) D:\code\gis_data_processing>main.exe
Unhandled exception in thread started by <bound method GISDataProcess.generate_file_execute of <__main__.GISDataProcess object at 0x0000021A0C5D8DC8>>
Traceback (most recent call last):
File "main.py", line 156, in generate_file_execute
generate_shapefile(file_path, shape_path)
File "gis_data_process.py", line 172, in generate_shapefile
kml_to_shapefile(kml_path, shape_path)
File "gis_data_process.py", line 417, in kml_to_shapefile
geojson_to_shapefile(geojson_path, shape_path)
File "gis_data_process.py", line 220, in geojson_to_shapefile
geometry = geopandas.read_file(geojson_path)
File "geopandas\io\file.py", line 166, in _read_file
File "geopandas\io\file.py", line 81, in _check_fiona
ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
Importing fiona resulted in: No module named 'fiona._shim'
The solution is as follows:
- find the. Spec file generated by packaging, find hiddenimports, add “Fiona. _shim”, delete the build and dist directories generated by packaging, and use pyinstaller main.spec to package and generate exe OL>
3. Fiona.shema cannot be found by executing exe
The error information is as follows:
(gis_data_process) D:\code\gis_data_processing>main.exe
Unhandled exception in thread started by <bound method GISDataProcess.generate_file_execute of <__main__.GISDataProcess object at 0x00000220B655B5E8>>
Traceback (most recent call last):
File "main.py", line 156, in generate_file_execute
generate_shapefile(file_path, shape_path)
File "gis_data_process.py", line 172, in generate_shapefile
kml_to_shapefile(kml_path, shape_path)
File "gis_data_process.py", line 417, in kml_to_shapefile
geojson_to_shapefile(geojson_path, shape_path)
File "gis_data_process.py", line 220, in geojson_to_shapefile
geometry = geopandas.read_file(geojson_path)
File "geopandas\io\file.py", line 166, in _read_file
File "geopandas\io\file.py", line 81, in _check_fiona
ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
Importing fiona resulted in: No module named 'fiona.schema'
The solution is as follows:
- find the. Spec file generated by packaging, find hiddenimports, add “Fiona. Schema”, delete the build and dist directories generated by packaging, and use pyinstaller main.spec to package and generate exe OL>
4. Summary
After the above three steps are completed, you can successfully package into exe, but opening exe has a black window. You can change console = true to console = false in the spec file, and then use pyinstaller main.spec to package and generate exe, so that there is no black window
Read More:
- The problem encountered in pyinstaller packaging “failed to execute script × *”
- Error loading in pyinstaller packaging
- Solutions to the problem of cannot find existing pyqt5 plugin directories encountered in pyinstaller packaging
- Error in react build packaging test environment
- Solutions to errors in geopandas installation
- Several solutions to HDF5 error reporting in Python environment
- Solution of Prophet error reporting when installing R package in Kubuntu virtual machine environment
- Spring boot problem 1: error reporting life processing instructions for building a spring boot project
- Anaconda create environment, delete environment, activate environment, exit environment
- The problem of failed to create process occurs in pyinstaller package program of Python
- Failed to import module __PyInstaller_hooks_0_IPython required by hook for module
- Error reporting – the project directly introduces the error reporting and solution of. SCSS file
- [error record] Android App packaging error (entry name ‘assets / xxx. XML’ merged)
- Summary of solutions to open flash back problem after Python packaging
- Pyinstaller packages the EXE file and executes the error unknown encoding: IDNA
- The solution that ioni cannot use HTTP request after packaging apk
- Configuration of OpenGL development environment under Windows environment, win10 + vs2019 + glfw + glad
- The pyinstaller settings icon appears“ struct.error : unpack requires a buffer of 16 bytes”
- How to Solve UE4 packaging Android error
- Vue picture path, webpack error resolution after packaging