geojson-precision
geojson-precision copied to clipboard
ImportError due to Shapely version 2 installation
After building and installing (with python3 setup.py build and python3 setup.py install), I saw the following error when running geojson-precision:
$ geojson-precision -p 2 < example.geojson
Traceback (most recent call last):
File "/usr/local/bin/geojson-precision", line 11, in <module>
load_entry_point('geojson-precision==0.0.1', 'console_scripts', 'geojson-precision')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.8/dist-packages/geojson_precision-0.0.1-py3.8.egg/geojson_precision/__init__.py", line 1, in <module>
from shapely.geometry import asShape
ImportError: cannot import name 'asShape' from 'shapely.geometry' (/usr/local/lib/python3.8/dist-packages/shapely-2.0b2-py3.8-linux-x86_64.egg/shapely/geometry/__init__.py)
It seems that the setup script installed using Shapely version 2, but geojson-precision is not compatible with this version. Instead Shapely version 1 must be used.