Search code examples
pythonpipjupyter-notebookgeopy

Jupyter notebook cannot import package geopy


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?


Solution

  • 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