Jupyter notebook cannot import package geopy

372 Views Asked by At

Working in a Jupyter notebook, installed the package geopy and restart kernel.

import geopy
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-99b9d2081153> in <module>
----> 1 import geopy

ModuleNotFoundError: No module named 'geopy

I can confirm geopy is istalled (from within Jupyter notebook) by running:

!pip install  geopy
Requirement already satisfied: geopy in ./venv/lib/python3.8/site-packages (2.0.0)
Requirement already satisfied: geographiclib<2,>=1.49 in ./venv/lib/python3.8/site-packages (from geopy) (1.50)

If it may helps:

!python -V
Python 3.8.3

!which python
/home/kabir/Desktop/dataset/venv/bin/python

What's wrong here?

2

There are 2 best solutions below

0
On BEST ANSWER

Try to install it with the specific pip what's associated with your current Python kernel which is running inside Jupyter:

import sys
!{sys.executable} -m  pip install geopy
0
On

Try the following command in your default command line and in Jupyter notebook.

which python

The path should match the one that you have in Jupyter notebook, if it doesn't than this is your issue.