ModuleNotFoundError: No module named 'matplotlib'

Hi i have a problem and i tried lots of thing but i did not solve it, can somebody help me?. I am using jupyter and i want to run some code but I am always facing this problem ModuleNotFoundError: No module named ‘matplotlib’aaa

that means matplotlib may not be installed in the same environment as the jupyter notebook. One way to install matplotlib is to

  1. create a new cell in the notebook
  2. install using ipython magics, by in that cell typing one of the following commands.
    If you use pip for installing libraries, type
%pip install matplotlib

and if you use conda, type

%conda install matplotlib
  1. execute the cell
  2. restart the kernel

Also if you’ve already tried this suggestion and it hasn’t worked, please describe everything else you’ve tried too.

if I remember correctly i tried %pip install matplotlib and %conda install matplotlib but now I searched in anaconda navigator matplotlib and installed it, now it works. Thank you for your help.