Reputation: 467
I installed both shapely and geopandas in the docker image:
COPY ["requirement.txt", "/app/"]
RUN pip install -r requirement.txt
The base of the image:
FROM python:3.7-slim
In the requirement.txt, I have geopandas, shapely and pygeos installed:
geopandas==0.8.1
pygeos==0.9
Shapely==1.7.1
When I run the python script in the docker container, I am receiving this warning message:
/usr/local/lib/python3.7/site-packages/geopandas/_compat.py:88: UserWarning: The Shapely GEOS version (3.8.0-CAPI-1.13.1 ) is incompatible with the GEOS version PyGEOS was compiled with (3.9.0-CAPI-1.16.2). Conversions between both will be slow.
shapely_geos_version, geos_capi_version_string
and following that I am receiving this error message:
File "SIMILARITY_RANK.py", line 16, in <module>
import geopandas as gpd
File "/usr/local/lib/python3.7/site-packages/geopandas/__init__.py", line 3, in <module>
from geopandas.geoseries import GeoSeries # noqa
File "/usr/local/lib/python3.7/site-packages/geopandas/geoseries.py", line 12, in <module>
from geopandas.base import GeoPandasBase, _delegate_property
File "/usr/local/lib/python3.7/site-packages/geopandas/base.py", line 13, in <module>
from .array import GeometryArray, GeometryDtype
File "/usr/local/lib/python3.7/site-packages/geopandas/array.py", line 25, in <module>
from . import _vectorized as vectorized
File "/usr/local/lib/python3.7/site-packages/geopandas/_vectorized.py", line 39, in <module>
type_mapping = {p.value: _names[p.name] for p in pygeos.GeometryType}
File "/usr/local/lib/python3.7/site-packages/geopandas/_vectorized.py", line 39, in <dictcomp>
type_mapping = {p.value: _names[p.name] for p in pygeos.GeometryType}
KeyError: 'MISSING'
It seems something is wrong with the installation of pygeos.
I could run the code in the local virtual environment, and all the packages are the same in the requirement.txt.
Thank you in advance!
Upvotes: 4
Views: 2525
Reputation: 7814
As mentioned in the comment by @Georgy:
See this issue: https://github.com/geopandas/geopandas/issues/1793. Looks like using 0.8.2 version of GeoPandas should solve the problem.
GeoPandas 0.8.1 is not compatible with new pygeos 0.9. You will need to use GeoPandas 0.8.2, which fixes the issue or downgrade pygeos to 0.8.
Upvotes: 2