Home > front end >  No module named 'matplotlib' after conda installation
No module named 'matplotlib' after conda installation

Time:11-23

I created a new environment and added it to jupyter like this:

conda create --name tf_plot tensorflow matplotlib
conda install -c anaconda ipykernel
python -m ipykernel install --user --name tf_plot

but when I try to

import matplotlib

I get ModuleNotFoundError: No module named 'matplotlib'

conda list shows

_tflow_select             2.3.0                     eigen
absl-py                   0.13.0           py38haa95532_0
aiohttp                   3.7.4.post0      py38h2bbff1b_2
astor                     0.8.1            py38haa95532_0
astunparse                1.6.3                      py_0
async-timeout             3.0.1            py38haa95532_0
attrs                     21.2.0             pyhd3eb1b0_0
blas                      1.0                         mkl
blinker                   1.4              py38haa95532_0
brotli                    1.0.9                ha925a31_2
brotlipy                  0.7.0           py38h2bbff1b_1003
ca-certificates           2021.10.26           haa95532_2
cachetools                4.2.2              pyhd3eb1b0_0
certifi                   2021.10.8        py38haa95532_0
cffi                      1.15.0           py38h2bbff1b_0
chardet                   4.0.0           py38haa95532_1003
charset-normalizer        2.0.4              pyhd3eb1b0_0
click                     8.0.3              pyhd3eb1b0_0
coverage                  5.5              py38h2bbff1b_2
cryptography              3.4.8            py38h71e12ea_0
cycler                    0.10.0                   py38_0
cython                    0.29.24          py38h604cdb4_0
dataclasses               0.8                pyh6d0b6a4_7
fonttools                 4.25.0             pyhd3eb1b0_0
freetype                  2.10.4               hd328e21_0
gast                      0.4.0              pyhd3eb1b0_0
google-auth               1.33.0             pyhd3eb1b0_0
google-auth-oauthlib      0.4.4              pyhd3eb1b0_0
google-pasta              0.2.0              pyhd3eb1b0_0
grpcio                    1.36.1           py38hc60d5dd_1
h5py                      2.10.0           py38h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha925a31_3
idna                      3.2                pyhd3eb1b0_0
importlib-metadata        4.8.1            py38haa95532_0
intel-openmp              2021.4.0          haa95532_3556
jpeg                      9d                   h2bbff1b_0
keras-applications        1.0.8                      py_1
keras-preprocessing       1.1.2              pyhd3eb1b0_0
kiwisolver                1.3.1            py38hd77b12b_0
libpng                    1.6.37               h2a8f88b_0
libprotobuf               3.17.2               h23ce68f_1
libtiff                   4.2.0                hd0e1b90_0
libwebp                   1.2.0                h2bbff1b_0
lz4-c                     1.9.3                h2bbff1b_1
markdown                  3.3.4            py38haa95532_0
matplotlib                3.4.3            py38haa95532_0
matplotlib-base           3.4.3            py38h49ac443_0
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0            py38h2bbff1b_0
mkl_fft                   1.3.1            py38h277e83a_0
mkl_random                1.2.2            py38hf11a4ad_0
multidict                 5.1.0            py38h2bbff1b_2
munkres                   1.1.4                      py_0
numpy                     1.21.2           py38hfca59bb_0
numpy-base                1.21.2           py38h0829f74_0
oauthlib                  3.1.1              pyhd3eb1b0_0
olefile                   0.46               pyhd3eb1b0_0
openssl                   1.1.1l               h2bbff1b_0
opt_einsum                3.3.0              pyhd3eb1b0_1
pillow                    8.4.0            py38hd45dc43_0
pip                       21.2.2           py38haa95532_0
protobuf                  3.17.2           py38hd77b12b_0
pyasn1                    0.4.8              pyhd3eb1b0_0
pyasn1-modules            0.2.8                      py_0
pycparser                 2.21               pyhd3eb1b0_0
pyjwt                     2.1.0            py38haa95532_0
pyopenssl                 21.0.0             pyhd3eb1b0_1
pyparsing                 3.0.4              pyhd3eb1b0_0
pyqt                      5.9.2            py38ha925a31_4
pyreadline                2.1                      py38_1
pysocks                   1.7.1            py38haa95532_0
python                    3.8.12               h6244533_0
python-dateutil           2.8.2              pyhd3eb1b0_0
qt                        5.9.7            vc14h73c81de_0
requests                  2.26.0             pyhd3eb1b0_0
requests-oauthlib         1.3.0                      py_0
rsa                       4.7.2              pyhd3eb1b0_1
scipy                     1.7.1            py38hbe87c03_2
setuptools                58.0.4           py38haa95532_0
sip                       4.19.13          py38ha925a31_0
six                       1.16.0             pyhd3eb1b0_0
sqlite                    3.36.0               h2bbff1b_0
tensorboard               2.4.0              pyhc547734_0
tensorboard-plugin-wit    1.6.0                      py_0
tensorflow                2.3.0           mkl_py38h8c0d9a2_0
tensorflow-base           2.3.0           eigen_py38h75a453f_0
tensorflow-estimator      2.6.0              pyh7b7c402_0
termcolor                 1.1.0            py38haa95532_1
tk                        8.6.11               h2bbff1b_0
tornado                   6.1              py38h2bbff1b_0
typing-extensions         3.10.0.2             hd3eb1b0_0
typing_extensions         3.10.0.2           pyh06a4308_0
urllib3                   1.26.7             pyhd3eb1b0_0
vc                        14.2                 h21ff451_1
vs2015_runtime            14.27.29016          h5e58377_2
werkzeug                  2.0.2              pyhd3eb1b0_0
wheel                     0.37.0             pyhd3eb1b0_1
win_inet_pton             1.1.0            py38haa95532_0
wincertstore              0.2              py38haa95532_2
wrapt                     1.12.1           py38he774522_1
xz                        5.2.5                h62dcd97_0
yarl                      1.6.3            py38h2bbff1b_0
zipp                      3.6.0              pyhd3eb1b0_0
zlib                      1.2.11               h62dcd97_4
zstd                      1.4.9                h19a0ad4_0

This sentence is here because stackoverflow requires me to add more details to this question but I'm not sure what more info can I provide. If this question is unclear in any way please inform me about this in the comments and I'll edit it

CodePudding user response:

Going by the SO answer here the virtual environment named tf_plot needs to be activated first before import. i.e,

conda activate -n tf_plot

Please check conda documentation here for more details

  • Related