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:
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.