0
votes

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?

1
Is your notebook using the global interpreter? It looks like you're using a virtual environment (tensorflow) when installing from the command-line. - J. Blackadar
How do I check if I am? I ran it also as (base) C:\Users\danie>pip3 install matplotlib if thats what you mean. - Daniel
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 - J. Blackadar
Dude you are the man thank you so much - Daniel
No problem! Adding as an answer to make it easier for others to find. - J. Blackadar

1 Answers

1
votes

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