python-3.xgeopandasshapelygeos

geopandas / Shapely Compatibility


I am using Shapely, geopandas and pygeos and get the following warning:

UserWarning: The Shapely GEOS version (3.10.2-CAPI-1.16.0) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.

The respective versions are:

Shapely                  1.8.2
geopandas                0.10.2
pygeos                   0.12.0

Question:

Can I solve this issue by upgrading / downgrading one of the versions? I was not able to find a list of compatible versions.


Solution

  • The following solution (originally posted here) worked for me:

    pip install --force-reinstall --no-binary shapely shapely

    If encounter OSError: /home/users/xxx/miniconda3/envs/nuplan/lib/libgeos_c.so: cannot open shared object file: No such file or directory, then do

    conda install -c conda-forge pygeos

    to fix the missing library problem eventually you have to do (not necessary in my case)

    export LD_LIBRARY_PATH=$LD_LIBARRY_PATH:$HOME/miniconda3/env/nuplan/lib