Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named 'geopy' ipython-notebook

Tags:

python

geopy

currently I need to make some distance calculation. For this I am trying the following on my ipython-notebook (version 4.0.4):

from geopy.distance import vincenty

ig_gruendau = (50.195883, 9.115557)
delphi = (49.99908,19.84481)

print(vincenty(ig_gruendau,delphi).miles)

Unfortunately I receive the following error when running the code above: ImportError: No module named 'geopy'

Since I am pretty new at python, I wonder how can I install this module (without admin rights) or what other simple options I do have for this calculations?

Thanks, ML

like image 919
user5446609 Avatar asked Mar 17 '16 15:03

user5446609


1 Answers

You need to install the missing module in your python installation. So you have to run the command:

pip install geopy

in your terminal. If you don't have pip, you'll have to install it using:

easy_install pip

and if both command fail with Permission denied, then you'll have to either launch the command as root:

sudo easy_install pip
sudo pip install geopy

or for pip, install it only for your user:

pip install geopy --user

And for future reference, whenever you get that kind of error:

ImportError: No module named 'XXXXX'

you can search for it on pypi using pip:

% pip search XXXXX

and in your case:

% pip search geopy
tornado-geopy (0.1.0)  - tornado-geopy is an asynchronous version of the awesome geopy library.
geopy.jp (0.1.0)       - Geocoding library for Python.
geopy.jp-2.7 (0.1.0)   - Geocoding library for Python.
geopy (1.11.0)         - Python Geocoding Toolbox

HTH

like image 150
zmo Avatar answered Nov 08 '22 03:11

zmo