Jupyter Notebook can't find modules for python 3.6

38,000

Solution 1

Try the following:

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

Make sure that Panda is installed using pip3.

Solution 2

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

Solution 3

Issue seems to be resolved by running

pip3 install rather than pip install

Solution 4

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

Share:
38,000

Related videos on Youtube

Harris2018
Author by

Harris2018

Updated on February 09, 2022

Comments

  • Harris2018
    Harris2018 over 1 year

    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!

    • amb1s1
      amb1s1 almost 5 years
      Run python --version and show us the output. What I'm thinking is that you have two versions of python running on your machine. The terminal is running one and atom is running the other version.
  • Harris2018
    Harris2018 almost 5 years
    ran those commands but the issue still ocurrs in atom via hydrogen. when I ran import pandas it threw the module not found error but when I importy numpy it did not throw me any error.
  • amb1s1
    amb1s1 almost 5 years
    Run pip3 list to show the list of install packages and see if panda is on that list.
  • Harris2018
    Harris2018 almost 5 years
    using pip3 install seems to have done the trick. Its strange because when i used pip install and conda install it says the package was already there. Is this something I need to fix or be worried about?
  • amb1s1
    amb1s1 almost 5 years
    pip install install python 2.x packages and pip3 install python 3.x.
  • Rexcirus
    Rexcirus over 3 years
    pip3 install jupyter
  • Charlie Parker
    Charlie Parker over 3 years
    I tried doing that but then it complains I need to upgrade but when I try to upgrade says it's already upgraded but pip3 doesnt think so...chickecn and egg problem? ` (automl) brandomiranda~ ❯ pip3 install ERROR: You must give at least one requirement to install (see "pip help install") You are using pip version 10.0.1, however version 19.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (automl) brandomiranda~ ❯ pip install --upgrade pip Requirement already up-to-date: pip in ./miniconda3/envs/automl/lib/python3.7/site-packages (19.3.1) `
  • Charlie Parker
    Charlie Parker over 3 years
    it didn't install anything. Why? Error: Requirement not upgraded as not directly required: tornado>=4.2 in /usr/local/lib/python3.6/site-packages (from ipykernel) (6.0.3) Requirement not upgraded as not directly required: jupyter-client in /usr/local/lib/python3.6/site-packages (from ipykernel) (5.3.4) there are more errors but they don't fit in a comment.
  • Punnerud
    Punnerud over 2 years
    If you don't have pip3, try "python3 -m pip install ipykernel --upgrade"
  • Michael Gruner
    Michael Gruner over 2 years
    Woked for me, thanks. Care to explain what happened and why does this work?
  • odbhut.shei.chhele
    odbhut.shei.chhele almost 2 years
    Worked like a charm
  • Faheeem Sajjad
    Faheeem Sajjad over 1 year
    for some 'python3 -m ipykernel install --user' might not work. Instead use, 'py -3 -m ipykernel install --user' on cmd-windows
  • Faheeem Sajjad
    Faheeem Sajjad over 1 year
    for some 'python3 -m ipykernel install --user' might not work. Instead use, 'py -3 -m ipykernel install --user' on cmd-windows

Related