Skip to content Skip to sidebar Skip to footer

Unable To Import Geopy Into Jupyter Even After Pip Installation

I'm trying to install geopy to use in Jupyter, but I keep getting the following error when I try to import it. import geopy ModuleNotFoundErrorTraceback (most recent call last) &l

Solution 1:

i encountered the same problem and now i fixed it. so in top part of jupyter notebook click kernel then you change kernel into a different python interpretur (that has geopy package). if you have only 1 interpreter here is how you create a new one.

open your command prompt (terminal in your computer). and create new enviroment.

follow these steps: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

when you created new enviroment close your command promt and open again:

  1. activate {name you created when creating enviroment}
  2. pip install geopy

then refresh your screen open your jupyter notebook change kernel. you should see your conda enviroment. if you don't see it or confused at any of the steps contact me via instagram: @raxham_habs_01

Solution 2:

OK I had a bit of a headache with this as I was doing a training program and the guy who was showing did not have it accurate.

Here are some links and suggestions to try to fix. I was using Anaconda for the Jupyter Notebook.

From "https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/pqFuJBDcBb4" one of the last comments had the command.

So just open Anaconda CLI prompt as Administrator.

conda install -c conda-forge geopy

Once you have done that you have to ensure you are using the right syntax as some of it has changed from the "tutorials" out there. Here is a great explanation: https://github.com/geopy/geopy

from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="My_geolocate")

lookingFor = "Moscow"
locations = geolocator.geocode(lookingFor)

print(locations)

RESULTS:

Locating Moscow

Москва, Центральный федеральный округ, Россия

If you want returned location in English:

locations = geolocator.geocode(lookingFor, language="en")

References: https://anaconda.org/conda-forge/geopyhttps://github.com/geopy/geopy

Post a Comment for "Unable To Import Geopy Into Jupyter Even After Pip Installation"