Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

ErrorCorner

ErrorCorner Logo ErrorCorner Logo

ErrorCorner Navigation

  • Home
  • Contact Us
  • About Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Contact Us
  • About Us
Home/ Questions/Q 602
Next
Answered
Kenil Vasani
Kenil Vasani

Kenil Vasani

  • 646 Questions
  • 567 Answers
  • 77 Best Answers
  • 26 Points
View Profile
  • 7
Kenil Vasani
Asked: December 14, 20202020-12-14T21:06:44+00:00 2020-12-14T21:06:44+00:00In: Python

jupyter notebook import error: no module named ‘matplotlib’

  • 7

I’m an ubuntu 16.4 user and I installed anaconda3 and using both python2 and python3 kernels.

>>>jupyter kernelspec list
Available kernels:
python2 /home/peterkim/.local/share/jupyter/kernels/python2
python3 /home/peterkim/anaconda3/share/jupyter/kernels/python3

and.. the problem was that I don’t know where/how to install packages in order to for my python2 jupyter notebook not to make error ‘no module named …’.
I tried pip install matplotlib and conda install matplotlib and I also appended ‘/home//anaconda2/pkgs’ to the sys.path.

(I also installed anaconda2 in search of the way of using parallel kernels. After I realised that anaconda2 was not needed. but I didn’t uninstall it.)

screenshot

thank you for helping me in advance..!

jupyter-notebookpython
  • 1 1 Answer
  • 9 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    1 Answer

    • Voted
    1. Kenil Vasani

      Kenil Vasani

      • 646 Questions
      • 567 Answers
      • 77 Best Answers
      • 26 Points
      View Profile
      Best Answer
      Kenil Vasani
      2020-12-14T21:02:23+00:00Added an answer on December 14, 2020 at 9:02 pm

      I’d recommend reading through here:

      https://conda.io/docs/py2or3.html

      I had the same problem after installing a Python 2.7 environment inside my Anaconda3 installation. I’m not sure which command I used to create the environment, but it actually didn’t install all the optional packages that are usually bundled with Anaconda (like matplotlib, numpy, …). But that’s not a big issue, you can easily install additional packages with pip as follows:

      First, list your conda environments:

      C:\Users\Felix>conda info --envs
      # conda environments:
      #
      ipykernel_py2            D:\Anaconda\envs\ipykernel_py2
      root                  *  D:\Anaconda
      

      Next, activate your python 2 environment using source activate <env> (Linux/OSX) or activate <env> (Windows):

      C:\Users\Felix>activate ipykernel_py2
      
      (ipykernel_py2) C:\Users\Felix>
      

      Finally, use pip to install the required packages:

      (ipykernel_py2) C:\Users\Felix>pip install matplotlib
      Collecting matplotlib
      ...
      Successfully installed matplotlib-2.0.0
      

      Hope that this helps.

      • 6
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    You must login to add an answer.

    Forgot Password?

    Sidebar

    Ask A Question
    • Popular
    • Kenil Vasani

      SyntaxError: invalid syntax to repo init in the AOSP code

      • 5 Answers
    • Kenil Vasani

      xlrd.biffh.XLRDError: Excel xlsx file; not supported

      • 3 Answers
    • Kenil Vasani

      Homebrew fails on MacOS Big Sur

      • 3 Answers
    • Kenil Vasani

      runtimeError: package fails to pass a sanity check for numpy ...

      • 3 Answers
    • Kenil Vasani

      ERROR: torch has an invalid wheel, .dist-info directory not found

      • 2 Answers

    Explore

    • Most Answered
    • Most Visited
    • Most Voted
    • Random

    © 2020-2021 ErrorCorner. All Rights Reserved
    by ErrorCorner.com