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"))
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?
(Feb 20, 2025) We just ran into this with Anaconda; in particular, its most recent geopandas is 0.14.2, which when selected for installation, automatically installs fiona 1.10 as one of its dependencies. Unfortunately as noted above, this triggers the error. Forcing geopandas to 0.14.4 is possible, but other things broke (including spyder). Things worked ok if you install the most recent geopandas and then separately downgrade the fiona to 1.9.5. (python v is 3.12).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With