ustroetz / python-osrm

A Python wrapper around the OSRM API
MIT License
133 stars 55 forks source link

ImportError: cannot import name 'griddata' #36

Closed janddd closed 5 years ago

janddd commented 5 years ago

I get the following error when importing this module.

  File "e:\software\anaconda3\envs\wmlpython3\lib\site-packages\osrm\extra.py", line 14, in <module>
    from matplotlib.mlab import griddata

ImportError: cannot import name 'griddata'

It seems that griddata from matplotlib.mlab is removed from the latest matplotlib versions.

See also link:

https://matplotlib.org/3.1.0/api/api_changes.html

matplotlib.mlab removals Lots of code inside the matplotlib.mlab module which was deprecated in Matplotlib 2.2 has been removed.

See below for a list: mlab.griddata (use scipy.interpolate.griddata)

zifeo commented 5 years ago

Thanks for reporting this issue. It was fix by #33 but not published yet, you can install directly:

pip3 install --upgrade git+https://github.com/ustroetz/python-osrm.git 
harisbal commented 3 years ago

Hello, any chance to publish the fix. It undermines an excellent library!

Abhi8162 commented 2 years ago

im getting this error whil trying to import osrm. Any fix? ImportError: cannot import name 'griddata' from 'matplotlib.mlab'

MaximCamilleri commented 2 years ago

hi, i am also still getting this error, any updates?

Johnycrown commented 2 years ago

I am getting this errors as well

zhaomh1998 commented 1 year ago

I was able to temporarily resolve it by going into extra.py that caused the problem and replacing from matplotlib.mlab import griddata with from scipy.interpolate import griddata.

nepomnyi commented 1 year ago

Thanks a lot man @zhaomh1998 ! Turns out griddata was removed from matplotlib. A helpful example of how to convert your matplotlib's griddata to scipy's griddata is given in the Olivier Gauthe's comment under this StackOverflow post.