Shared streamlit with geopandas

i’m just trying to load some shape files in to streamlit and want to use geopandas to read the files in from github where i’ve added them…

i’ve got the following libraries in my requirements.txt file

and am getting the following error

File "/home/appuser/.local/lib/python3.7/site-packages/streamlit/", line 332, in _run_script
    exec(code, module.__dict__)
File "/app/streamlit-example/", line 41, in <module>
    city = gpd.read_file("")
File "/home/appuser/.local/lib/python3.7/site-packages/geopandas/io/", line 96, in _read_file
    with reader(path_or_bytes, **kwargs) as features:
File "/home/appuser/.local/lib/python3.7/site-packages/fiona/", line 556, in __init__
    encoding='utf-8', **kwds)
File "/home/appuser/.local/lib/python3.7/site-packages/fiona/", line 162, in __init__
    self.session.start(self, **kwargs)
File "fiona/ogrext.pyx", line 540, in fiona.ogrext.Session.start
File "fiona/_shim.pyx", line 81, in fiona._shim.gdal_open_vector

Hi @alibama, welcome to the Streamlit community!

Can you share more of the error message? It’s not really clear from what you posted what Python is objecting to.

Hi @randyzwitch - i think the issue is with the fiona library - i’m trying to open files and i think fiona wants to do some file conversion juju on the back end? so maybe it’s a file system issue?

i dunno… shape files are common (but they are also proprietary BS, so there’s that…). i’m going to look and see if i can get the data in geojson and if that works i’ll post that approach on here for the next soul :slight_smile:

File "/home/appuser/.local/lib/python3.7/site-packages/streamlit/", line 332, in _run_script
    exec(code, module.__dict__)File "/app/streamlit-example/", line 43, in <module>
    test = gpd.read_file("")File "/home/appuser/.local/lib/python3.7/site-packages/geopandas/io/", line 96, in _read_file
    with reader(path_or_bytes, **kwargs) as features:File "/home/appuser/.local/lib/python3.7/site-packages/fiona/", line 556, in __init__
    encoding='utf-8', **kwds)File "/home/appuser/.local/lib/python3.7/site-packages/fiona/", line 162, in __init__
    self.session.start(self, **kwargs)File "fiona/ogrext.pyx", line 540, in fiona.ogrext.Session.startFile "fiona/_shim.pyx", line 81, in fiona._shim.gdal_open_vector
1 Like

Yeah, I’ve messed with GDAL and the like in a previous job, not so fun.

Keep in mind that you can also specify a packages.txt file, to add system-level dependencies. Maybe start by installing GDAL on the image and see if that gets you somewhere:

Thanks Randy - I appreciate the response, and bonus points for not making me feel like a total idiot on here :slight_smile:
i really dig streamlit and hope i can do something helpful with it… it’s a great tool and an amazing step in the right direction!

1 Like

ok - i’ve been going through the packages.txt file stuff & could use some documentation there? if i need to add the repository to apt-get install gdal i’m not sure how to do that?

i definitely think i need gdal & more than that libspatialindex for analyzing geospatial data regardless…

i’ve used this repository to set up the back end for jupyter notebooks? any thoughts