简体   繁体   中英

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM