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

AttributeError: module 'osrm' has no attribute 'Client'

Open IsaacDm opened this issue 5 years ago • 7 comments

I have installed osrm-py in my jupyter successfully. Yet, when I run the following test code it throws "AttributeError: module 'osrm' has no attribute 'Client'

import osrm client = osrm.Client(host='http://localhost:5000') response = client.route( coordinates=[[-74.0056, 40.6197], [-74.0034, 40.6333]], overview=osrm.overview.full) print(response)

My environment: Operating System: CentOS 7, 64bit Python 3.5.6 :: Anaconda 4.1.1 (64-bit)

IsaacDm avatar Mar 11 '20 18:03 IsaacDm

I am getting the exact same error. My environment is Python 3.8.5 and Ubuntu 20.04.1 LTS. Is there any idea on this?

cbabalis avatar Apr 29 '21 09:04 cbabalis

AttributeError: module 'osrm' has no attribute 'table' i have installed osrm-py and im getting this error. Do we have any alternative for osrm.table

Abhi8162 avatar Dec 28 '21 07:12 Abhi8162

Could you please elaborate more? I successfully use osrm.table. First, you have to run the osrm server.

cbabalis avatar Dec 28 '21 09:12 cbabalis

Could you please elaborate more? I successfully use osrm.table. First, you have to run the osrm server.

osrm_result = osrm.table(locations, output='raw', annotations='distance'), i need to run this particular block of code so it gives me this error AttributeError: module 'osrm' has no attribute 'table'

Abhi8162 avatar Dec 28 '21 12:12 Abhi8162

I see. To my understanding though, it does not seem to work. Maybe you could try to go with this [1]. I am able to run the exact command you put above and get the results. In this, the "table" is absolutely there.

dir(osrm) Out[20]: ['AccessIsochrone', 'DefaultRequestConfig', 'Point', 'RequestConfig', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', '_chain', 'base64', 'core', 'extra', 'match', 'namedtuple', 'nearest', 'simple_route', 'sys', 'table', 'trip']

If I run your command, I get: locations = [[25.7175216,35.190589],[25.8753275,40.845692]]

In [22]: dist_od = osrm.table(locations, output='pandas', annotations='distance')

In [23]: dist_od Out[23]: ( 0 1 0 0.0 1195886.8 1 1197131.4 0.0, [[25.7182, 35.191183], [25.875501, 40.845421]], None)

So maybe try this [1] instead. [1] https://github.com/ustroetz/python-osrm

cbabalis avatar Dec 28 '21 12:12 cbabalis

But I'm not able to install osrm=0.11.3. I tried gdal and Fiona packages which was early errors. Then I was able to run pip install osrm command on terminal and it is getting installed but when I check the same on python interpreter it says package to be installed and it gives me error when trying to install it. Any suggestions is much appreciated

On Tue, 28 Dec, 2021, 6:08 pm Babis Babalis, @.***> wrote:

I see. To my understanding though, it does not seem to work. Maybe you could try to go with this [1]. I am able to run the exact command you put above and get the results. In this, the "table" is absolutely there.

dir(osrm) Out[20]: ['AccessIsochrone', 'DefaultRequestConfig', 'Point', 'RequestConfig', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', '_chain', 'base64', 'core', 'extra', 'match', 'namedtuple', 'nearest', 'simple_route', 'sys', 'table', 'trip']

If I run your command, I get: locations = [[25.7175216,35.190589],[25.8753275,40.845692]]

In [22]: dist_od = osrm.table(locations, output='pandas', annotations='distance')

In [23]: dist_od Out[23]: ( 0 1 0 0.0 1195886.8 1 1197131.4 0.0, [[25.7182, 35.191183], [25.875501, 40.845421]], None)

So maybe try this [1] instead. [1] https://github.com/ustroetz/python-osrm

— Reply to this email directly, view it on GitHub https://github.com/gojuno/osrm-py/issues/7#issuecomment-1002081005, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW752OZCH6ZOMFYN6VHBLEDUTGVVLANCNFSM4LF4BEWQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Abhi8162 avatar Dec 28 '21 14:12 Abhi8162

But I'm not able to install osrm=0.11.3.

@Abhi8162 Maybe you're mixing up the packages osrm-py and python-osrm (which is comprehensible).

Here, we're in the repository for osrm-py, but your problem seems related to python-osrm. Try pip install osrm-py to install osrm-py, instead of pip install osrm. It works like a charm for me.

jeanbaptisteb avatar Sep 12 '22 13:09 jeanbaptisteb