Magnum Python 93'
Magnum Python 93'

Reputation: 37

AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)

I am trying to create a geospatial Python GUI app using PyQT5, Geopandas, OSMnX, and Folium. I am converting the app into an .EXE file using pyinstaller. Previously, I was successfully able to create a .EXE file when not importing geopandas. But I am getting an error once I use Geopandas to build the executable as shown in the screenshot. enter image description here

This is how my spec file looks for building the executable.


block_cipher = None

hidden_imports = [
'fiona',
'gdal',
'shapely',
'shapely.geometry',
'pyproj',
'rtree',
'geopandas.datasets',
'pytest',
'pandas._libs.tslibs.timedeltas',
'fiona._shim',
]


a = Analysis(['main.py'],
             pathex=['D:\\CrowdSourcingV2'],
             binaries=[],
             datas=[
             ('input', 'input'), 
             ('input', 'input'),
             ("D:\\Anaconda\\envs\\ox\Lib\\site-packages\\branca\\*.json","branca"),
             ("D:\\Anaconda\\envs\\ox\\Lib\\site-packages\\branca\\templates","templates"),
             ("D:\\Anaconda\\envs\\ox\\Lib\\site-packages\\folium\\templates","templates")
             ],
             hiddenimports=hidden_imports,
             hookspath=[],
             hooksconfig={},
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,  
          [],
          name='Crowdsourcing Tool',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=True,
          disable_windowed_traceback=False,
          target_arch=None,
          codesign_identity=None,
          entitlements_file=None )

Could someone provide any hint or solution on how I can resolve this issue?

Upvotes: 0

Views: 5371

Answers (1)

Marc Garcia
Marc Garcia

Reputation: 3497

This is a problem in the Fiona package. It has been reported there: https://github.com/conda-forge/fiona-feedstock/issues/138

A workaround in RedHat based distros is to install dnf install libnsl. Not sure how libnsl can be installed in Windows, but if there is a way that should fix the problem. Installing libnsl with Anaconda doesn't seem to solve the problem, but you can give it a try too.

Upvotes: 1

Related Questions