question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DriverError: Operation timed out when opening shapefile with geopandas from S3 bucket

See original GitHub issue

I am getting this error inside a docker container built with the only command FROM pangeo/pangeo-notebook:latest, I hope this helps defining the environment, but I’m happy to provide more explicit information if needed.

I have verified that I have access to the private S3 bucket where the file is located, and I can correctly open parquet files (for example) from the same bucket with geopandas, so this issue seems specific to fiona (and/or gdal).


In [1]: import geopandas as gpd

In [2]: gpd.read_file("s3://path/to/shapefile.shp")
---------------------------------------------------------------------------
CPLE_AppDefinedError                      Traceback (most recent call last)
fiona/_shim.pyx in fiona._shim.gdal_open_vector()

fiona/_err.pyx in fiona._err.exc_wrap_pointer()

CPLE_AppDefinedError: Operation timed out after 1001 milliseconds with 0 bytes received

During handling of the above exception, another exception occurred:

DriverError                               Traceback (most recent call last)
<ipython-input-2-068760f4508f> in <module>
----> 1 gpd.read_file("s3://path/to/shapefile.shp").geometry

/srv/conda/envs/notebook/lib/python3.9/site-packages/geopandas/io/file.py in _read_file(filename, bbox, mask, rows, **kwargs)
    199
    200     with fiona_env():
--> 201         with reader(path_or_bytes, **kwargs) as features:
    202
    203             # In a future Fiona release the crs attribute of features will

/srv/conda/envs/notebook/lib/python3.9/site-packages/fiona/env.py in wrapper(*args, **kwargs)
    406     def wrapper(*args, **kwargs):
    407         if local._env:
--> 408             return f(*args, **kwargs)
    409         else:
    410             if isinstance(args[0], str):

/srv/conda/envs/notebook/lib/python3.9/site-packages/fiona/__init__.py in open(fp, mode, driver, schema, crs, encoding, layer, vfs, enabled_drivers, crs_wkt, **kwargs)
    254
    255         if mode in ('a', 'r'):
--> 256             c = Collection(path, mode, driver=driver, encoding=encoding,
    257                            layer=layer, enabled_drivers=enabled_drivers, **kwargs)
    258         elif mode == 'w':

/srv/conda/envs/notebook/lib/python3.9/site-packages/fiona/collection.py in __init__(self, path, mode, driver, schema, crs, encoding, layer, vsi, archive, enabled_drivers, crs_wkt, ignore_fields, ignore_geometry, **kwargs)
    160             if self.mode == 'r':
    161                 self.session = Session()
--> 162                 self.session.start(self, **kwargs)
    163             elif self.mode in ('a', 'w'):
    164                 self.session = WritingSession()

fiona/ogrext.pyx in fiona.ogrext.Session.start()

fiona/_shim.pyx in fiona._shim.gdal_open_vector()

DriverError: Operation timed out after 1001 milliseconds with 0 bytes received

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
LewisJarrodcommented, Mar 21, 2022

Thanks, and I can confirm we are using version 1.8.21. We will implement the workaround for now!

1reaction
sgilliescommented, Mar 21, 2022

@LewisJarrod I wonder if this is related to https://github.com/rasterio/rasterio/issues/1521? The fiona 1.8.x series lacks that fix, and I will look into that.

@rbuffat’s suggestion of creating a new session object for each use of fiona is the workaround for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Driver error reading file geodatabase from S3 using geopandas
We are seeing similar issues using read-only keys for S3 locations and shapefiles (and possibly even NAS folders with read-only permissions) ...
Read more >
DriverError when reading GeoPackage with geopandas
I wrote a script using geopandas to open shapefiles(geojson and shp). It was able to read some files and some others not. It...
Read more >
Fiona Documentation - Read the Docs
Here is an example of using Fiona to read some records from one data file, change their geometry attributes, and write them to...
Read more >
Fiona 1.8.22 - PythonFix.com
The fiona package has 90 open issues on GitHub. DriverError: Operation timed out when opening shapefile with geopandas from S3 bucket ...
Read more >
geopandas.GeoDataFrame.to_file
Write the GeoDataFrame to a file. By default, an ESRI shapefile is written, but any OGR data source supported by Fiona can be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found