0

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?

  • Possible duplication of: https://stackoverflow.com/questions/54975897/unable-to-import-geopy-into-jupyter-even-after-piop-installation – dee cue Oct 12 '20 at 14:09
  • Make sure jupyter uses the same python executable as reported by the `which` command. It looks like they are different in your environment. – KostyaEsmukov Oct 12 '20 at 18:15

2 Answers2

0

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.

BeeFriedman
  • 1,800
  • 1
  • 11
  • 29
0

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
Péter Leéh
  • 2,069
  • 2
  • 10
  • 23