Python Forum

Full Version: matplotlib isn't recognized after installation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I've installed matplotlib using the following command:
python -m pip install matplotlib

But when I try use it in ma code I get this message:
ModuleNotFoundError: No module named 'matplotlib'

Any comments ?

Thanks.

How many python installations do you have? Do you use virtual environments? How do you run your code?
I guess I've one Python installation.
Anyway I can check - does exist any instriuction in Linux to check this ?
I use Jupyter as environment and run my code there.
if you are on Linux most distros come with python2 and python3 installed. python will run system python2, so I guess you installed matplotib in system python2. Now the question is what version runs in Jupyter

you can run $ which python to see what version invoke python command.
The Jupyter version: 3.6.8

Executing $which python in terminal outputs this: Python 2.7.15+

Resolved.
The instruction sudo apt-get install python3-matplotlib fixed the problem.
Thanks.
Remember to use pip3 in the future not pip(as it install to Python 2).
Look also at pyenv Simple Python Version Management can make stuff simpler.