As reported here, when you use Anaconda, install the packet using conda. In this case, the right instruction to use (on Ubuntu 18.04) is:

conda install -c conda-forge matplotlib

This will solve the problem.

If you use pip (you can), you will mess up all the dependencies (and for instance, the probability that other scripts/programs do not work anymore is not null: if you use Spyder, you will have big dependencies problem to face).

Optional:

In order to always avoid problem like this, I recommend you to use Virtual Enviroment:

Whats is it?

Geeksforgeeks explains it clearly.

How?

A step-by-step guide is always useful.

Answer from Leos313 on Stack Overflow
🌐
Anaconda.org
anaconda.org › conda-forge › matplotlib
matplotlib - conda-forge
A community-led collection of recipes, build infrastructure, and distributions for the conda package manager.
🌐
Matplotlib
matplotlib.org › stable › install › index.html
Installation — Matplotlib 3.10.8 documentation
Matplotlib is available both via the anaconda main channel ... If you are using the Python version that comes with your Linux distribution, you can install Matplotlib via your package manager, e.g.:
Discussions

python - anaconda cannot import matplotlib.pyplot - Stack Overflow
I am getting this error when I am trying to import "matplotlib.pyplot". I cant even install matplotlib.pyplot through conda install. It shows this: import matplotlib.pyplot Traceback (most recen... More on stackoverflow.com
🌐 stackoverflow.com
python - How do I install Matplotlib 3.4.1 in Anaconda? - Stack Overflow
I want to use a package only available in version 3.4.1. When I do conda list then I see my matplotlib version is 3.2.2. I've tried conda.install matplotlib=3.4.1 but that return a PackagesNotFound... More on stackoverflow.com
🌐 stackoverflow.com
How install matplotlib using Anaconda Navigator
Is pip working? Try using pip. conda activate test_env pip install matplotlib More on reddit.com
🌐 r/learnpython
3
2
March 15, 2020
Conda Not installing Matplotlib for PyPlot
I started with a fresh install of Julia 1.9.0-rc1 (I wiped .julia clean) PyCall Conda does not seem to be installing matplotlib correctly. This has worked for me many times before on many different machines…The culprit seems to be ResolvePackageNotFound: - conda==23.1.0 which is strange, ... More on discourse.julialang.org
🌐 discourse.julialang.org
1
0
March 30, 2023
🌐
Anaconda.org
anaconda.org › anaconda › matplotlib
matplotlib - anaconda | Anaconda.org
January 13, 2026 - anaconda/matplotlib · Community · Publication quality figures in Python · Overview · Files 869 · Labels 1 · Badges · Versions · 3.10.8 · To install this package, run one of the following: $conda install anaconda::matplotlib · Monthly · Downloads Updates ·
🌐
GitHub
github.com › conda-forge › matplotlib-feedstock
GitHub - conda-forge/matplotlib-feedstock: A conda-smithy repository for matplotlib. · GitHub
# Search all versions available on your platform: mamba repoquery search matplotlib --channel conda-forge # List packages depending on `matplotlib`: mamba repoquery whoneeds matplotlib --channel conda-forge # List dependencies of `matplotlib`: mamba repoquery depends matplotlib --channel conda-forge · conda-forge is a community-led conda channel of installable packages.
Starred by 22 users
Forked by 58 users
Languages   Batchfile 54.9% | Shell 45.1%
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › how install matplotlib using anaconda navigator
r/learnpython on Reddit: How install matplotlib using Anaconda Navigator
March 15, 2020 -

I've created a virtual environment named test_env I have been trying to add matplotlib using Anaconda Navigator this way

Then, it installs something. After installation finishes, it is like before installation again. I know, it is weird. But why it happens?

Also when I go to Anaconda Prompt and write these

activate test_env

conda install matplotlib

I see this error

ERROR conda.core.link:_execute(700): An error occurred while installing package
'defaults::qt-5.9.7-vc14h73c81de_0'.
Rolling back transaction: done

LinkError: post-link script failed for package defaults::qt-5.9.7-vc14h73c81de_0

location of failed script: C:\Users\mustafa\anaconda3\envs\test_env\Scripts\.qt-
post-link.bat
==> script messages <==
<None>
==> script output <==
stdout:         1 file(s) copied.

stderr: 'chcp' is not recognized as an internal or external command,
operable program or batch file.
'chcp' is not recognized as an internal or external command,
operable program or batch file.
'chcp' is not recognized as an internal or external command,
operable program or batch file.

return code: 1

()

🌐
GeeksforGeeks
geeksforgeeks.org › techtips › how-to-install-matplotlib-on-anaconda
How to Install Matplotlib on Anaconda? - GeeksforGeeks
July 23, 2025 - Matplotlib is a Python library for data visualization that allows users to create static, interactive, and animated plots. If you're using Anaconda, a leading platform for Python data science, installing Matplotlib is straightforward.
🌐
Julia Programming Language
discourse.julialang.org › specific domains › visualization
Conda Not installing Matplotlib for PyPlot - Visualization - Julia Programming Language
March 30, 2023 - I started with a fresh install of Julia 1.9.0-rc1 (I wiped .julia clean) PyCall Conda does not seem to be installing matplotlib correctly. This has worked for me many times before on many different machines…The culprit seems to be ResolvePackageNotFound: - conda==23.1.0 which is strange, since If I look in .julia, I see two conda Versions perrin@perrin76:~/.julia/conda/3/x86_64/pkgs$ ls con* conda-23.1.0-py310hff52083_0.conda conda-23.3.0-py310hff52083_0.conda conda-package-handling-2.0...
🌐
Professorkazarinoff
professorkazarinoff.github.io › Problem-Solving-101-with-Python › 05-Plotting-with-Matplotlib › 05.02-Installing Matplotlib
Installing Matplotlib - Problem Solving 101 with Python
To install matplotlib with the Anaconda Prompt, open the Anaconda Prompt and type: > conda install matplotlib · Type y for yes when prompted. To install Matplotlib with pip (the Python package manager), open a terminal window and type: $ pip install matplotlib ·
🌐
PyPI
pypi.org › project › matplotlib
matplotlib · PyPI
Matplotlib produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, Python/IPython shells, web application servers, and various graphical user interface toolkits. See the install documentation, which is generated from /doc/install/index.rst
      » pip install matplotlib
    
Published   Dec 10, 2025
Version   3.10.8
🌐
Google Groups
groups.google.com › g › fenics-support › c › WwgsDjc4aP4
conda install with matplotlib
> ImportError: > /home/genet/.... Weird… Anyway, thanks again. Martin On 16/12/2017 10:34, Praveen C wrote: > Did you try > > conda install -n fenics -c conda-forge matplotlib > > Best > praveen...
🌐
Matplotlib
matplotlib.org › 2.2.0 › users › installing.html
Installing — Matplotlib 2.2.0 documentation
# only the first time... conda install conda-build # the Python version you want a package for... set CONDA_PY=3.5 # builds the package, using a clean build environment conda build ci\conda_recipe # install the new package conda install --use-local matplotlib
🌐
Problem Solving with Python
problemsolvingwithpython.com › 06-Plotting-with-Matplotlib › 06.02-Installing Matplotlib
Installing Matplotlib - Problem Solving with Python
Matplotlib can be installed using with the Anaconda Prompt. If the Anaconda Prompt is available on your machine, it can usually be seen in the Windows Start Menu. To install Matplotlib, open the Anaconda Prompt and type: > conda install matplotlib · Type y for yes when prompted.
🌐
Matplotlib
matplotlib.org › 3.7.3
Matplotlib documentation — Matplotlib 3.7.3 documentation
Install using conda: conda install -c conda-forge matplotlib · Further details are available in the Installation Guide. Tutorials · Quick-start guide · Plot types · Introductory tutorials · External learning resources · How-tos · Example gallery · Matplotlib FAQ ·
🌐
scikit-learn
scikit-learn.org › stable › install.html
Installing scikit-learn — scikit-learn 1.8.0 documentation
If you have not installed NumPy or SciPy yet, you can also install these using conda or pip. When using pip, please ensure that binary wheels are used, and NumPy and SciPy are not recompiled from source, which can happen when using particular configurations of operating system and hardware (such as Linux on a Raspberry Pi). Scikit-learn plotting capabilities (i.e., functions starting with plot_ and classes ending with Display) require Matplotlib...
🌐
Anaconda
anaconda.com › home › free download
Download Anaconda Distribution | Anaconda
April 8, 2025 - Open-source package and environment management system that runs on Windows, macOS, and Linux. Install, run, and update packages and their dependencies.
🌐
NumPy
numpy.org › install
NumPy - Installing NumPy
Choose the method that best suits your needs. If you’re unsure, start with the Environment-based method using conda or pip. Below are the different methods for installing NumPy.
🌐
Matplotlib
matplotlib.org › 3.5.2 › users › installing › index.html
Installation — Matplotlib 3.5.2 documentation
conda install -c conda-forge matplotlib · Matplotlib is part of major Python distributions: Anaconda · ActiveState ActivePython ·
🌐
Pandas
pandas.pydata.org › docs › getting_started › install.html
Installation — pandas 3.0.1 documentation
conda create -c conda-forge -n name_of_my_env python pandas # On Linux or MacOS source activate name_of_my_env # On Windows activate name_of_my_env ... For users that are new to Python, the easiest way to install Python, pandas, and the packages that make up the PyData stack such as SciPy, ...