No Module Named Matplotlib Error Fix

No Module Named Matplotlib : Step by Step Fix

No module named matplotlib error comes because either matplotlib is not installed or its path is not set properly. We can reinstall it to fix it. Sometimes we need to uninstall the older version if that is causing this error.  In this article, We will see many ways of installing it.

No module named matplotlib : Fix –

As we have already mentioned that we need to install/ reinstall matplotlib. Here we will mention a few different methods. Let’s see one by one.

Method 1: Installing matplotlib using pip –

pip package manager is one the easiest way for installing any python package. You may use the below command for installing matplotlib.

pip install matplotlib
no module name matplotlib
no module named matplotlib

Please ignore “!” before pip if you are running at local. It is specific to collab notebook. For your local system, It works the same as we have mentioned.

In some scenarios, Like with python 3.x version, You may alter the command-

python3 -m pip install matplotlib

Note –

1. If you have still issue with existing/older version of matplotlib. You may uninstall matplotlib. Here is the command for this.

pip uninstall matplotlib

It will remove the older version which is causing the issue of “no module named matplotlib”.

2. In some scenario, We do not have pip install on the system. In that case, We need to install the pip manager first.

python -m pip install -U pip
python -m pip install -U matplotlib

This will install pip package. On top of it, It will install the matplotlib package for you.


Method 2: Matplotlib Installation using Conda Manager –

Similar to pip, We have another option as conda manager. Open the Anaconda Prompt and use the below command.

conda install matplotlib

Another way is to go with the conda-forge.

conda install -c conda-forge matplotlib

Conclusion –

I hope now you may easily resolve the bug no module named matplotlib. Still, if you are stuck with it. Please let us know. You many comments below in the comment box.


Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner