python-osrm icon indicating copy to clipboard operation
python-osrm copied to clipboard

Error Importing osrm

Open AsharFatmi opened this issue 3 years ago • 2 comments

Hi, I am working on python 3.8, I have installed both GDAL and Fiona:-

Fiona-1.8.19-cp38-cp38-win_amd64.whl
GDAL-3.2.2-cp38-cp38-win_amd64.whl

Then I executed pip install osrm

Everything was successfully installed

But I get an error when I try to import osrm:-

>>> import osrm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\site-packages\osrm\__init__.py", line 54, in <module>
    from .extra import AccessIsochrone
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\site-packages\osrm\extra.py", line 8, in <module>
    from shapely.geometry import MultiPolygon, Polygon, Point
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\site-packages\shapely\geometry\__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\site-packages\shapely\geometry\base.py", line 19, in <module>
    from shapely.coords import CoordinateSequence
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\site-packages\shapely\coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\site-packages\shapely\geos.py", line 154, in <module>
    _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
  File "C:\Users\ashar\anaconda3\envs\testOSRM\lib\ctypes\__init__.py", line 381, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\ashar\anaconda3\envs\testOSRM\Library\bin\geos_c.dll' (or one of its dependencies). Try using the full path with constructor syntax.

testOSRM

Any Ideas?

AsharFatmi avatar Apr 19 '21 09:04 AsharFatmi

@AsharFatmi This seems to be an issue related to geos in your environment. I am not able to replicate. Maybe stackoverflow is a better place to ask such questions. A similar issue.

zifeo avatar Oct 07 '21 11:10 zifeo

@AsharFatmi I recall gdal versioning being finicky when I have worked with it in the past. Have you tried installing gdal and osrm at the same time using an environment solver such as conda?

ladoramkershner avatar Apr 28 '23 18:04 ladoramkershner