Trying to deploy a streamlit app on streamlit sharing. The app works fine both locally and in docker. However, on streamlit sharing it gives me the following error on the log file:
import geopandas as gpd
File "/home/appuser/.conda/lib/python3.7/site-packages/geopandas/__init__.py", line 1, in <module>
from geopandas._config import options # noqa
File "/home/appuser/.conda/lib/python3.7/site-packages/geopandas/_config.py", line 126, in <module> default_value=_default_use_pygeos(),
File "/home/appuser/.conda/lib/python3.7/site-packages/geopandas/_config.py", line 112, in _default_use_pygeos
import geopandas._compat as compat
File "/home/appuser/.conda/lib/python3.7/site-packages/geopandas/_compat.py", line 10, in <module>
import shapely.geos
File "/home/appuser/.conda/lib/python3.7/site-packages/shapely/geos.py", line 87, in <module> _lgeos = load_dll('geos_c', fallbacks=alt_paths)
File "/home/appuser/.conda/lib/python3.7/site-packages/shapely/geos.py", line 62, in load_dll libname, fallbacks or []))
OSError: Could not find lib geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so'].
Should be something related to GEOS dependency with shapely and geopandas. Does anyone know how to solve it?
To add system-level dependencies, you can create a packages.txt file. In the case of GEOS, try adding libgeos-dev into the packages.txt file, commit it to GitHub and see if that loads your app.
Thanks for that! However, now it is giving me this :
ERROR 1: PROJ: proj_create_from_database: Open of /home/appuser/.conda/share/proj failed
/home/appuser/.conda/lib/python3.7/site-packages/pyproj/__init__.py:73: UserWarning: Valid PROJ data directory not found. Either set the path using the environmental variable PROJ_LIB or with `pyproj.datadir.set_data_dir`.
warnings.warn(str(err))
I resolved the error by setting the path using the environmental variable PROJ_LIB. Add the following lines to the top of run_.py before you import other modules: