0

(I manged to solve this by installing anaconda and installing geopandas in a new environment)

My original problem:

I want to write a geopandas dataframe as a shapefile. I'm writing my geodataframe (gdf) to_file:

gdf.to_file('series.shp')

But I'm getting the error:

ImportError: the 'to_file' method requires the 'fiona' package, but it is not installed or does not import correctly. Importing fiona resulted in: DLL load failed while importing ogrext: The specified procedure could not be found.

I have read similar questions in here, and I tried to import fiona before geopandas. I have tried this, however when I import fioana first, I get the following error when using the "to_file".

OSError: exception: access violation reading 0x0000000000000000

I have following versions installed:

  • Fiona version: 1.8.21
  • Gdal version: 3.4.1
  • Geopandas version: 0.10.2

Fiona and gdal was installed from the following wheels: https://www.lfd.uci.edu/~gohlke/pythonlibs/

I did Fiona installation for windows and tried to follow procedure from here: https://pypi.org/project/Fiona/

  • "The directory containing the GDAL DLL (gdal304.dll or similar) needs to be in your Windows PATH (e.g. C:\gdal\bin)." I added: C:\Users[MyUsername]\AppData\Local\Programs\Python\Python39\Lib\site-packages\osgeo and where I have located the gdal304.dll
  • "The gdal-data directory needs to be in your Windows PATH or the environment variable GDAL_DATA must be set (e.g. C:\gdal\bin\gdal-data)." I added to the path: C:\Users[MyUsername]\AppData\Local\Programs\Python\Python39\Lib\site-packages\osgeo\data\gdal
  • "The environment variable PROJ_LIB must be set to the proj library directory (e.g. C:\gdal\bin\proj6\share)" I made an new environmental variable PROJ_LIB to: C:\Users[MyUsername]\AppData\Local\Programs\Python\Python39\Lib\site-packages\osgeo\data\proj

I also added the environmental variable GDAL_VERSION 3.4.1.

I did all this editing in the Windows System Properties

When i did the installation of the fiona wheel I got "ERROR: Failed building wheel for gdal", however, fiona imports in python afterwards.

I have python 3.9.7 installed.

I also have some other issues using geopandas: Error using geopandas overlay with union method But I don't know whether they may be related.

Anyone knows what is getting wrong here?

gjerhau
  • 1
  • 2

0 Answers0