Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter Notebook can't find modules for python 3.6

Not sure what happened but whenever I use ipython, hydrogen (atom) or jupyter notebook can't find any of the installed modules. I know I have pandas installed but the notebook says its not found.

I should add that when I run the script normally (python script.py) it does import without any errors.

Suggestions?

Thanks!

like image 310
Harris2018 Avatar asked Jun 18 '18 17:06

Harris2018


People also ask

Why is a module not found in Jupyter Notebook?

If you're getting ModuleNotFoundError in Jupyter, first double-check that you installed the package with pip install . Triple-check you didn't misspell the package name in your import, otherwise you'll waste a lot of time reading this page.


4 Answers

Try the following:

pip3 install ipykernel --upgrade python3 -m ipykernel install --user 

Make sure that Panda is installed using pip3.

like image 52
amb1s1 Avatar answered Sep 23 '22 21:09

amb1s1


I was having a similar issue. I installed a text processing tool using pip3. The installation was successful and I was able to run the test-code from the terminal, however I was unable to execute the same code from jupyter notebook. Checked that the sys.version was 3.7.1 in notebook but the terminal version was 3.6.9.

The problem was resolved after executing the following commands and relaunching the notebook:

pip3 install ipykernel --upgrade python3 -m ipykernel install --user 
like image 21
Doi Avatar answered Sep 25 '22 21:09

Doi


Issue seems to be resolved by running

pip3 install rather than pip install

like image 41
Harris2018 Avatar answered Sep 24 '22 21:09

Harris2018


Fix for Visual Studio Code

Look to the top right corner and click on the displayed Python version.

enter image description here

It should appear a list of your Python versions. Scroll down to the Python version you want to use and click on it.

enter image description here

After that you should see the Python version you selected in the top right corner.

enter image description here

like image 34
Justice Bringer Avatar answered Sep 23 '22 21:09

Justice Bringer