I am trying to import matplotlib.pyplot in an anaconda environment on Windows and I keep running into this issue. I have looked at previous Stack Overflow answers for this problem and it seems like this is a pathing issue but I can’t seem to fix it. I tried uninstalling and reinstalling matplotlib but this does not fix the issue. I am able to run a python instance from the terminal and import matplotlib.pyplot, but I can’t import it in a jupyter notebook instance called from the same terminal.
For added bonus, when I tried fiddling with paths I am no longer able to run jupyter lab when it was working just now, with the error
No module named 'jupyter_server'.
Source: Windows Questions