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

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

Open
IsaacDm opened this issue Mar 11, 2020 · 7 comments
Open

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

IsaacDm opened this issue Mar 11, 2020 · 7 comments

Comments

@IsaacDm
Copy link

IsaacDm commented Mar 11, 2020

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)

@cbabalis
Copy link

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?

@Abhi8162
Copy link

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

@cbabalis
Copy link

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

@Abhi8162
Copy link

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'

@cbabalis
Copy link

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

@Abhi8162
Copy link

Abhi8162 commented Dec 28, 2021 via email

@jeanbaptisteb
Copy link

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.

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

4 participants