[FIXED] Matplotlib in Tensorflow Jupyter Notebook

Issue

In Anaconda Navigator, I switched to running applications on tensorflow and installed jupyter 5.6.0. I then open up a Python3 notebook. I then import tensorflow, keras and numpy without issue. Then when I try to import matplotlib, the notebook says ImportError: No module named ‘matplotlib’.

I tried running the following command in my anaconda prompt in both base and after activating tensorflow: pip3 install matplotlib

And it says:

(tensorflow) C:\Users\danie>pip3 install matplotlib
Requirement already satisfied

for 7 different lines. What am I doing wrong?

Solution

Add import sys and sys.executable to the top of your notebook, then run it. This shows you the directory of the running kernel. With this information, from a new command-line (not a Python console) run C:\path\to\python.exe -m pip install matplotlib

Answered By – J. Blackadar

Answer Checked By – Pedro (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published