Failing to install matplot on Python 3.10

C:\Users\User>pip install matplotlib
Collecting matplotlib
Using cached matplotlib-3.4.3.tar.gz (37.9 MB)
Preparing metadata (setup.py) … done
Requirement already satisfied: cycler>=0.10 in c:\users\user\lib\site-packages (from matplotlib) (0.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\user\lib\site-packages (from matplotlib) (1.3.2)
Requirement already satisfied: numpy>=1.16 in c:\users\user\lib\site-packages (from matplotlib) (1.21.4)
Requirement already satisfied: pillow>=6.2.0 in c:\users\user\lib\site-packages (from matplotlib) (8.4.0)
Requirement already satisfied: pyparsing>=2.2.1 in c:\users\user\lib\site-packages (from matplotlib) (3.0.4)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\user\lib\site-packages (from matplotlib) (2.8.2)
Requirement already satisfied: six>=1.5 in c:\users\user\lib\site-packages (from python-dateutil>=2.7->matplotlib) (1.16.0)
Building wheels for collected packages: matplotlib
Building wheel for matplotlib (setup.py) … error
ERROR: Command errored out with exit status 1:
command: ‘C:\Users\User\python.exe’ -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\User\AppData\Local\Temp\pip-install-9qt1o4hf\matplotlib_e8428d17e5154fbeafe1e74bc9471b0f\setup.py’"’"’; file=’"’"‘C:\Users\User\AppData\Local\Temp\pip-install-9qt1o4hf\matplotlib_e8428d17e5154fbeafe1e74bc9471b0f\setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ bdist_wheel -d ‘C:\Users\User\AppData\Local\Temp\pip-wheel-jh8i0oqn’
cwd: C:\Users\User\AppData\Local\Temp\pip-install-9qt1o4hf\matplotlib_e8428d17e5154fbeafe1e74bc9471b0f
Complete output (551 lines):

Edit setup.cfg to change the build options; suppress output with --quiet.

BUILDING MATPLOTLIB
matplotlib: yes [3.4.3]
python: yes [3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC
v.1929 64 bit (AMD64)]]
platform: yes [win32]
tests: no [skipping due to configuration]
macosx: no [Mac OS-X only]

running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
copying lib\pylab.py → build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\afm.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\animation.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\artist.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\axis.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\backend_bases.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\backend_managers.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\backend_tools.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\bezier.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\blocking_input.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\category.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\cm.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\collections.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\colorbar.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\colors.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\container.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\contour.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\dates.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\docstring.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\dviread.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\figure.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\fontconfig_pattern.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\font_manager.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\gridspec.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\hatch.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\image.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\legend.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\legend_handler.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\lines.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\markers.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\mathtext.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\mlab.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\offsetbox.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\patches.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\path.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\patheffects.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\pylab.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\pyplot.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\quiver.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\rcsetup.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\sankey.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\scale.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\spines.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\stackplot.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\streamplot.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\table.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\texmanager.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\text.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\textpath.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\ticker.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\tight_bbox.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\tight_layout.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\transforms.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\ttconv.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\type1font.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\units.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib\widgets.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_animation_data.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_cm.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_cm_listed.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_color_data.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_constrained_layout.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_enums.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_internal_utils.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_layoutgrid.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_mathtext.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_mathtext_data.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_pylab_helpers.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_text_layout.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_version.py → build\lib.win-amd64-3.10\matplotlib
copying lib\matplotlib_init_.py → build\lib.win-amd64-3.10\matplotlib
creating build\lib.win-amd64-3.10\mpl_toolkits
copying lib\mpl_toolkits_init_.py → build\lib.win-amd64-3.10\mpl_toolkits
creating build\lib.win-amd64-3.10\matplotlib\axes
copying lib\matplotlib\axes_axes.py → build\lib.win-amd64-3.10\matplotlib\axes
copying lib\matplotlib\axes_base.py → build\lib.win-amd64-3.10\matplotlib\axes
copying lib\matplotlib\axes_secondary_axes.py → build\lib.win-amd64-3.10\matplotlib\axes
copying lib\matplotlib\axes_subplots.py → build\lib.win-amd64-3.10\matplotlib\axes
copying lib\matplotlib\axes_init_.py → build\lib.win-amd64-3.10\matplotlib\axes
creating build\lib.win-amd64-3.10\matplotlib\backends

I’m also facing same problem for python 3.10 even have been tried possible solutions.

  1. python -m pip install -U matplotlib==3.2.0rc1
  2. python -m pip install -U matplotlib

Please provide the solution.

thanks
but i’m also have this problem, and this didn’t help me

I ended up downgrading to a lower version.
Try that it worked for me

I tried downgrading but it appears that for Windows 11 only Python 3.10.3 on Python Releases for Windows | Python.org.

Have earlier Python version on old PC and all’s well, but this now is my main PC and I can’t get a configuration of Python to access madplotlib.

Please try installing with

pip install -U --binary-only :all: matplotlib

which will only install wheels and not try to compile from source.

Tried it, no dice, got:

C:\Users\graha>pip install -U --binary-only :all: matplotlib

Usage:
C:\Users\graha\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe -m pip install [options] [package-index-options] …
C:\Users\graha\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe -m pip install [options] -r [package-index-options] …
C:\Users\graha\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe -m pip install [options] [-e] …
C:\Users\graha\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe -m pip install [options] [-e] …
C:\Users\graha\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe -m pip install [options] <archive url/path> …

no such option: --binary-only

Sorry, I flipped the order of the words in the command:

pip install -U --only-binary :all: matplotlib

Replied to your email, not sure if that appears here. For the record to cut a long story short I uninstalled and reinstalled Python 3.10 and then Matplotlib with pip and all’s well.

Possibly part of the explanation is that when I reinstalled Python I checked a box in the installer to add to PATH (windows environment variable). I don’t recall using the check box before, rather added it manually (wrongly?)