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
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