I am using tensorflow with jupyter notebook on windows 10.
However i enter the below code and getting the mentioned error message. . . .help me with step by step solution
%pylab inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
ModuleNotFoundError Traceback (most recent call last)
----> 1 get_ipython().run_line_magic('pylab', 'inline')
2 import matplotlib.pyplot as plt
3 import pandas as pd
4 import numpy as np
~\Anaconda3\envs\Tensorflow\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2093 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2094 with self.builtin_trap:
-> 2095 result = fn(args,*kwargs)
2096 return result
2097
~\Anaconda3\envs\Tensorflow\lib\site-packages\IPython\core\magic.py in
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, a, *k: f(a, *k)
188
189 if callable(arg):
~\Anaconda3\envs\Tensorflow\lib\site-packages\IPython\core\magics\pylab.py in pylab(self, line)
153 import_all = not args.no_import_all
154
--> 155 gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
156 self._show_matplotlib_backend(args.gui, backend)
157 print ("Populating the interactive namespace from numpy and matplotlib")
~\Anaconda3\envs\Tensorflow\lib\site-packages\IPython\core\interactiveshell.py in enable_pylab(self, gui, import_all, welcome_message)
3015 from IPython.core.pylabtools import import_pylab
3016
-> 3017 gui, backend = self.enable_matplotlib(gui)
3018
3019 # We want to prevent the loading of pylab to pollute the user's
~\Anaconda3\envs\Tensorflow\lib\site-packages\IPython\core\interactiveshell.py in enable_matplotlib(self, gui)
2964 """
2965 from IPython.core import pylabtools as pt
-> 2966 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)
2967
2968 if gui != 'inline':
~\Anaconda3\envs\Tensorflow\lib\site-packages\IPython\core\pylabtools.py in find_gui_and_backend(gui, gui_select)
268 """
269
--> 270 import matplotlib
271
272 if gui and gui != 'auto':
ModuleNotFoundError: No module named 'matplotlib'
That looks like matplotlib is not installed in the environment. From an Anaconda command prompt, activate the Tensorflow environment and then conda install matplotlib.
In cmd , I ran this command "python -m pip install -U matplotlib". This solved my problem.
Thanks, the re-install solved my similar problem with matplotlib on Windows 10. There is probably a smarter way to re-install, but this I think happened because I installed MikTex after matplotlib, and figuring out $PATH on Windows is non-trival.
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from keras.datasets import mnist
from keras.models import load_model
from keras.utils import to_categorical
Using TensorFlow backend.
In cmd , I ran this command "python -m pip install -U matplotlib". This solved my problem.
thank you so much
Most helpful comment
In cmd , I ran this command "python -m pip install -U matplotlib". This solved my problem.