Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import error: Referencing out of date polyline class #57

Open
ladoramkershner opened this issue Apr 28, 2023 · 0 comments
Open

Import error: Referencing out of date polyline class #57

ladoramkershner opened this issue Apr 28, 2023 · 0 comments

Comments

@ladoramkershner
Copy link

As of this commit, from December 2022, this package is referencing an out of date class from polyline. The methods from the PolylineCodec class were moved to be stand alone functions in the refactor. This causes the following error on import

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[5], line 1
----> 1 import osrm
      2 result = osrm.simple_route(
      3                       [21.0566163803209,42.004088575972], [20.9574645547597, 41.5286973392856],
      4                       output='route', overview="full", geometry='wkt')
      6 result[0]['distance']

File [~/miniconda3/envs/geocode/lib/python3.11/site-packages/osrm/__init__.py:53](https://file+.vscode-resource.vscode-cdn.net/Users/ladoramk/repos/geocode/~/miniconda3/envs/geocode/lib/python3.11/site-packages/osrm/__init__.py:53)
     49 RequestConfig = DefaultRequestConfig()
     51 Point = namedtuple("Point", ("longitude", "latitude"))
---> 53 from .core import match, simple_route, nearest, table, trip, _chain
     54 from .extra import AccessIsochrone

File [~/miniconda3/envs/geocode/lib/python3.11/site-packages/osrm/core.py:3](https://file+.vscode-resource.vscode-cdn.net/Users/ladoramk/repos/geocode/~/miniconda3/envs/geocode/lib/python3.11/site-packages/osrm/core.py:3)
      1 # -*- coding: utf-8 -*-
      2 import numpy as np
----> 3 from polyline.codec import PolylineCodec
      4 from polyline import encode as polyline_encode
      5 from pandas import DataFrame

ModuleNotFoundError: No module named 'polyline.codec'

Possible fix would be to replace the import with a try/except import (to be able to support backward compatibility). I am on a Mac and am struggling with of the other dependencies at the moment, but wanted to document!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant