Modulenotfounderror No Module Named ‘Matplotlib’ ImportError: Fix

No Module Named Matplotlib Error 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 Modulenotfounderror.  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 the collab notebook. For your local system, It works the same as we have mentioned.

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

python3 -m pip install matplotlib

Note –

1. If you have still an issue with the 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 scenarios, 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. Your 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.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages, where he and his team share knowledge and help others learn more about data science.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner