pythondataframedatabricksgeopandasfiona

How to Resolve AttributeError: module 'fiona' has no attribute 'path'?


I have a piece of code that was working fine until last week, but now it's failing with the following error:

AttributeError: module 'fiona' has no attribute 'path'

I’ve ensured that all the necessary libraries are installed and imported. Does anyone have any ideas on what might be going wrong or how I can resolve this issue?

Thanks!

 pip install geopandas
 pip install fiona

 import geopandas as gpd
 import fiona

 countries = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))

Solution

  • TL;DR update to geopandas==0.14.4 OR pin fiona to version 1.9.6

    --

    It seems fiona recently upgraded to 1.10.0 (as of 2024-09-04 01:14 UTC) and that may have broken some older versions of geopandas, which only depend on fiona being higher than some version, not lower than.

    Upon closer look, geopandas up to version 0.14.3 still calls fiona.path, but in version 0.14.4 it no longer does.

    So upgrading geopandas to 0.14.4 should fix it.

    Alternatively, forcing fiona to stay on version 1.9.6 should also work.

    NOTE: upgrading geopandas to >=1.0 seems to remove fiona as a dependency altogether, so it will also solve this issue. But it opens up a whole new can of worms by removing geopandas.dataset. For details on that one, see How to get maps to geopandas after datasets are removed?