ImportError: No module named 'matplotlib' -- Using Anaconda tensorflow environment

modulenotfounderror: no module named
importerror: no module named py
importerror: no module named mac
importerror: no module named linux
importerror: cannot import name
python no module named same directory
importerror: no module named xyz
importerror: no module named typing

I'm just trying to learn Tensorflow, but am totally new to Python, so I'm using Anaconda I created a conda environment:

$ conda create −n tensorflow python =3.5

Of course I activated my conda environment

$ source activate tensorflow

Then I played a bit around in Spyder, tried to plot a MNIST-digit (copy-paste code from my tutor which is tested several times), it includes of course

import matplotlib.pyplot as plt
[...]
plt.plot(number)

but executing the Python file with bash gives me:

(tensorflow) leon@leon-linux:~/ANNsCourse/Session1$ python helloWorld.py
Traceback (most recent call last):
  File "helloWorld.py", line 10, in <module>
    import matplotlib.pyplot as plt
ImportError: No module named 'matplotlib'

I'm quite confused right now, as the (tensorflow) in the bash obviously denotes that my conda tensorflow environment works (at least from my understanding). Also, from what I understood, conda should have matplotlib built in, right? And it should also load this in my conda tensorflow environment, right? This is what my tutor's slide said

There is no need to install further packages like numpy or matplotlib, since Anaconda contains current versions of them already.'

and also what I was able to take from everything I Googled and StackOverflowed. Neither Googling nor StackOverflowing gave me any good answer (might also just be because I don't understand enough yet).

My best guess would be that I still have to include matplotlib into my tensorflow conda environment, but this would be contradicting both my tutor & Google, while I also would not know how to do this.

edit: conda list gave me that matplotlib was not in my tensorflowenvironment, so I went

conda install matplotlib

I'm still afraid something is wrong with my conda tensorflow environment, shouldn't the matplotlib have been in there by default? It also told me:

Package plan for installation in environment /home/leon/.conda/envs/tensorflow:

The following NEW packages will be INSTALLED:

cycler:           0.10.0-py35_0    
dbus:             1.10.10-0        
expat:            2.1.0-0          
fontconfig:       2.12.1-3         
freetype:         2.5.5-2          
glib:             2.50.2-1         
gst-plugins-base: 1.8.0-0          
gstreamer:        1.8.0-0          
icu:              54.1-0           
jpeg:             9b-0             
libffi:           3.2.1-1          
libgcc:           5.2.0-0          
libiconv:         1.14-0           
libpng:           1.6.27-0         
libxcb:           1.12-1           
libxml2:          2.9.4-0          
matplotlib:       2.0.0-np112py35_0
mkl:              2017.0.1-0       
numpy:            1.12.0-py35_0    
pcre:             8.39-1           
pyparsing:        2.1.4-py35_0     
pyqt:             5.6.0-py35_2     
python-dateutil:  2.6.0-py35_0     
pytz:             2016.10-py35_0   
qt:               5.6.2-3          
sip:              4.18-py35_0      
six:              1.10.0-py35_0    

Proceed ([y]/n)? y

Which tells me also numpy was missing? Can someone confirm this to be correct now, or is there something fishy with my conda?

You just created a conda environment named tensorflow and switched into it. You haven't installed the tensorflow package or any of the default anaconda packages.

To do that, do

conda create -n tensorflow python=3.5 anaconda # install anaconda3 default packages
source activate tensorflow # switch into it
conda install -c conda-forge tensorflow # install tensorflow

Traps for the Unwary in Python's Import System — Nick Coghlan's , This has changed in Python 3.3: now any directory on sys.path with a name that "<string>", line 1, in <module> ImportError: No module named example.foo. I upgraded jupyter via pip install --upgrade jupyter, but I when I try to launch a new notebook using jupyter notebook, I am getting an error: ImportError: No module named paths. Here&#39;s the ful

I ran into the same problem using these instructions: https://www.anaconda.com/tensorflow-in-anaconda/ for tensorflow-gpu.

Running

conda create -n tensorflow_gpuenv tensorflow-gpu
conda activate tensorflow_gpuenv

should ensure that "TensorFlow is now installed and ready for use." But it doesn't. Running 'conda list' shows matplotlib was not installed. So you'll need to install that as well:

conda install -c conda-forge matplotlib

Python error “ImportError: No module named”, To get rid of this error you just need to create __init__.py in the appropriate directory and everything will work fine. To know more about this you� I have been running that code on the IDLE Python GUI >>> import wx Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> import wx ImportError: No module named wx – Luke Bream Dec 22 '11 at 21:14

I faced the same problem on my mac. So I ran conda list to see whether the matplotlib is installed or not. Once i found it missing, i went ahead and ran the command conda install matplotlib. After this step to verify it's properly installed; Do the following.

conda activate tf

This activates the tensorflow environment on anaconda. After this start interactive python shell on the same terminal.

import matplotlib

If its installed properly this should not throw any error now.

ImportError: No module named 'XYZ' | by Yufeng, ImportError: No module named 'XYZ'. Jupyter notebook cannot find the package you already installed? Let's solve the problem. Question: Biopython: ImportError: No module named TreeConstruction. 0. 5.4 years ago by. sivanc7 • 10. sivanc7 • 10 wrote: Hi to all! Someone knows why I get the

Python error “ImportError: No module named”, No module named”. 0 votes. My directory tree looks like this: (local directory)/ site-packages/toolkit/interface.py. My code is in here: This is the real reason of 'ImportError: No module named xxxxxx' occurred in PyCharm. To resolve this issue, you must add libraries to your project custom env by these steps: In PyCharm, from menu 'File'->Settings

ImportError: No module named github � Issue #856 � PyGithub , I'm trying to use PyGitHub and I'm getting "ImportError: No module named github". Setup specs: macOS v10.13.6 Python v3.7.0 Installed with� ImportError: No module named watson_developer_cloud Hot Network Questions This python code converts integers to strings and strings to ints without the inbuilt functions "int()" and "str()"

ImportError: No module named 'requests.packages' � Issue #471 , ImportError: No module named 'requests.packages' #471. Closed. AAverin opened this issue on Mar 26 � 11 comments. Closed� ImportError: No module named 'matplotlib' 2. ImportError: No module named google.auth. 0. Installing modules like pygal so they work in Spyder. Hot Network Questions

Comments
  • To be clear, since the answer isn't totally explicit, this is the expected behavior and absolutely nothing is wrong with your environment or conda.