I am using Jupyter notebook for a project, I have been writing in vs code but recently switched to Jupyter. The code was working in vs code but, already installed the modules with pip, but I am getting import error in Jupyter notebook. For;
import reverse_geocoder
from geopy.distance import geodesic
I am getting the
No module named 'reverse_geocoder'
No module named 'geopy'
errors. How I can install these to Jupyter?
Google is your friend.
You can find a pretty detailed solution here (I strongly suggest you to have a look at it).
Anyway, to sum up. I am assuming you wish to install directly from the Jupyter notebook. This probably means that you don't have Anaconda (otherwise I'd suggest to install through the Anaconda prompt) but I'll write down the solution also for that case.
If you do not have Anaconda then you can simply install it using pip
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install reverse_geocoder
If you have Anaconda:
# Install a conda package in the current Jupyter kernel
import sys
!conda install --yes --prefix {sys.prefix} reverse_geocoder
However, if you do have Anaconda installed you should simply open the Anaconda prompt and install the package using:
pip install reverse_geocoder
I had this problem and it turned out that I simply had the wrong python selected within VS Code. You have to select (in the upper right) the python environment corresponding to your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With