Matplotlib Installation issues with Python 3.10

Question:

First, I do not believe this is a duplicate post of matplotlib installation issue python 3 this
issue is relevant to matplotlib and Python 3.10 which was just recently released.

My Problem

I am having issues installing matplotlib with Python 3.10. I did not have these issues Python 3.9.6. When installing matplotlib, I referenced the official instructions and I used the following command:

  • python -m pip install -U matplotlib

Then I got this very long error message:

WARNING: Discarding https://files.pythonhosted.org/packages/7d/d4/e4c40c62cd8608ca09f0684e64139c56512e195f2351ac41a472d4dc8b38/matplotlib-3.3.0.tar.gz#sha256=24e8db94948019d531ce0bcd637ac24b1c8f6744ac86d2aa0eb6dbaeb1386f82 (from https://pypi.org/simple/matplotlib/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached matplotlib-3.2.2.tar.gz (40.3 MB)
    ERROR: Command errored out with exit status 1:
     command: 'D:GitHubCodexGigasPythonCrashCoursechapter15.project-envScriptspython.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\serap\AppData\Local\Temp\pip-install-z6821kj4\matplotlib_dd551371f0ba45a889cb056fa0e24291\setup.py'"'"'; __file__='"'"'C:\Users\serap\AppData\Local\Temp\pip-install-z6821kj4\matplotlib_dd551371f0ba45a889cb056fa0e24291\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('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersserapAppDataLocalTemppip-pip-egg-info-iiicui1u'
         cwd: C:UsersserapAppDataLocalTemppip-install-z6821kj4matplotlib_dd551371f0ba45a889cb056fa0e24291
    Complete output (277 lines):
    WARNING: The wheel package is not available.
      ERROR: Command errored out with exit status 1:
       command: 'D:GitHubCodexGigasPythonCrashCoursechapter15.project-envScriptspython.exe' 'D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagespip_vendorpep517in_process_in_process.py' build_wheel 'C:UsersserapAppDataLocalTemptmpinu_l323'
           cwd: C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5de
      Complete output (225 lines):
      setup.py:63: RuntimeWarning: NumPy 1.21.2 may not yet support Python 3.10.
        warnings.warn(
      Running from numpy source directory.
      C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5detoolscythonize.py:69: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
        from distutils.version import LooseVersion
      Processing numpy/random_bounded_integers.pxd.in
      Processing numpy/randombit_generator.pyx
      Processing numpy/randommtrand.pyx
      Processing numpy/random_bounded_integers.pyx.in
      Processing numpy/random_common.pyx
      Processing numpy/random_generator.pyx
      Processing numpy/random_mt19937.pyx
      Processing numpy/random_pcg64.pyx
      Processing numpy/random_philox.pyx
      Processing numpy/random_sfc64.pyx
      Cythonizing sources
      blas_opt_info:
      blas_mkl_info:
      No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      customize MSVCCompiler
        libraries mkl_rt not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      blis_info:
        libraries blis not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      openblas_info:
        libraries openblas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
      get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
      customize GnuFCompiler
      Could not locate executable g77
      Could not locate executable f77
      customize IntelVisualFCompiler
      Could not locate executable ifort
      Could not locate executable ifl
      customize AbsoftFCompiler
      Could not locate executable f90
      customize CompaqVisualFCompiler
      Could not locate executable DF
      customize IntelItaniumVisualFCompiler
      Could not locate executable efl
      customize Gnu95FCompiler
      Found executable C:Program Files (x86)mingw-w64mingw32bingfortran.exe
      Using built-in specs.
      COLLECT_GCC=C:Program Files (x86)mingw-w64mingw32bingfortran.exe
      COLLECT_LTO_WRAPPER=C:/Program Files (x86)/mingw-w64/mingw32/bin/../libexec/gcc/i686-w64-mingw32/8.1.0/lto-wrapper.exe
      Target: i686-w64-mingw32
      Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/lib -L/c/mingw810/prerequisites/i686-zlib-static/lib -L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
      Thread model: posix
      gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)
        NOT AVAILABLE

      accelerate_info:
        NOT AVAILABLE

      atlas_3_10_blas_threads_info:
      Setting PTATLAS=ATLAS
        libraries tatlas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      atlas_3_10_blas_info:
        libraries satlas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      atlas_blas_threads_info:
      Setting PTATLAS=ATLAS
        libraries ptf77blas,ptcblas,atlas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      atlas_blas_info:
        libraries f77blas,cblas,atlas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5denumpydistutilssystem_info.py:2026: UserWarning:
          Optimized (vendor) Blas libraries are not found.
          Falls back to netlib Blas library which has worse performance.
          A better performance should be easily gained by switching
          Blas library.
        if self._calc_info(blas):
      blas_info:
        libraries blas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5denumpydistutilssystem_info.py:2026: UserWarning:
          Blas (http://www.netlib.org/blas/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [blas]) or by setting
          the BLAS environment variable.
        if self._calc_info(blas):
      blas_src_info:
        NOT AVAILABLE

      C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5denumpydistutilssystem_info.py:2026: UserWarning:
          Blas (http://www.netlib.org/blas/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [blas_src]) or by setting
          the BLAS_SRC environment variable.
        if self._calc_info(blas):
        NOT AVAILABLE

      non-existing path in 'numpy\distutils': 'site.cfg'
      lapack_opt_info:
      lapack_mkl_info:
        libraries mkl_rt not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      openblas_lapack_info:
        libraries openblas not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
      get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
      customize GnuFCompiler
      customize IntelVisualFCompiler
      customize AbsoftFCompiler
      customize CompaqVisualFCompiler
      customize IntelItaniumVisualFCompiler
      customize Gnu95FCompiler
      Using built-in specs.
      COLLECT_GCC=C:Program Files (x86)mingw-w64mingw32bingfortran.exe
      COLLECT_LTO_WRAPPER=C:/Program Files (x86)/mingw-w64/mingw32/bin/../libexec/gcc/i686-w64-mingw32/8.1.0/lto-wrapper.exe
      Target: i686-w64-mingw32
      Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/lib -L/c/mingw810/prerequisites/i686-zlib-static/lib -L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
      Thread model: posix
      gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)
        NOT AVAILABLE

      openblas_clapack_info:
        libraries openblas,lapack not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
      get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
      customize GnuFCompiler
      customize IntelVisualFCompiler
      customize AbsoftFCompiler
      customize CompaqVisualFCompiler
      customize IntelItaniumVisualFCompiler
      customize Gnu95FCompiler
      Using built-in specs.
      COLLECT_GCC=C:Program Files (x86)mingw-w64mingw32bingfortran.exe
      COLLECT_LTO_WRAPPER=C:/Program Files (x86)/mingw-w64/mingw32/bin/../libexec/gcc/i686-w64-mingw32/8.1.0/lto-wrapper.exe
      Target: i686-w64-mingw32
      Configured with: ../../../src/gcc-8.1.0/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32 --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw810/prerequisites/i686-w64-mingw32-static --with-pkgversion='i686-posix-dwarf-rev0, Built by MinGW-W64 project' --with-bugurl=https://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -fno-ident -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS=' -I/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/include -I/c/mingw810/prerequisites/i686-zlib-static/include -I/c/mingw810/prerequisites/i686-w64-mingw32-static/include' LDFLAGS='-pipe -fno-ident -L/c/mingw810/i686-810-posix-dwarf-rt_v6-rev0/mingw32/opt/lib -L/c/mingw810/prerequisites/i686-zlib-static/lib -L/c/mingw810/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
      Thread model: posix
      gcc version 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)
        NOT AVAILABLE

      flame_info:
        libraries flame not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      atlas_3_10_threads_info:
      Setting PTATLAS=ATLAS
        libraries lapack_atlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries tatlas,tatlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries lapack_atlas not found in C:
        libraries tatlas,tatlas not found in C:
      <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
        NOT AVAILABLE

      atlas_3_10_info:
        libraries lapack_atlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries satlas,satlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries lapack_atlas not found in C:
        libraries satlas,satlas not found in C:
      <class 'numpy.distutils.system_info.atlas_3_10_info'>
        NOT AVAILABLE

      atlas_threads_info:
      Setting PTATLAS=ATLAS
        libraries lapack_atlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries ptf77blas,ptcblas,atlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries lapack_atlas not found in C:
        libraries ptf77blas,ptcblas,atlas not found in C:
      <class 'numpy.distutils.system_info.atlas_threads_info'>
        NOT AVAILABLE

      atlas_info:
        libraries lapack_atlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries f77blas,cblas,atlas not found in D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlib
        libraries lapack_atlas not found in C:
        libraries f77blas,cblas,atlas not found in C:
      <class 'numpy.distutils.system_info.atlas_info'>
        NOT AVAILABLE

      lapack_info:
        libraries lapack not found in ['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\lib', 'C:\']
        NOT AVAILABLE

      C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5denumpydistutilssystem_info.py:1858: UserWarning:
          Lapack (http://www.netlib.org/lapack/) libraries not found.
          Directories to search for the libraries can be specified in the
          numpy/distutils/site.cfg file (section [lapack]) or by setting
          the LAPACK environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
      lapack_src_info:
        NOT AVAILABLE

      C:UsersserapAppDataLocalTemppip-wheel-99zdamg9numpy_e42242834a6f47f2b97c9e7786bac5denumpydistutilssystem_info.py:1858: UserWarning:
          Lapack (http://www.netlib.org/lapack/) sources not found.
          Directories to search for the sources can be specified in the
          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
          the LAPACK_SRC environment variable.
        return getattr(self, '_calc_info_{}'.format(name))()
        NOT AVAILABLE

      numpy_linalg_lapack_lite:
        FOUND:
          language = c
          define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]

      Warning: attempted relative import with no known parent package
      C:UsersserapAppDataLocalProgramsPythonPython310libdistutilsdist.py:274: UserWarning: Unknown distribution option: 'define_macros'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running config_cc
      unifing config_cc, config, build_clib, build_ext, build commands --compiler options
      running config_fc
      unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
      running build_src
      build_src
      building py_modules sources
      creating build
      creating buildsrc.win-amd64-3.10
      creating buildsrc.win-amd64-3.10numpy
      creating buildsrc.win-amd64-3.10numpydistutils
      building library "npymath" sources
      error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
      ----------------------------------------
      ERROR: Failed building wheel for numpy
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagessetuptoolsinstaller.py", line 75, in fetch_build_egg
        subprocess.check_call(cmd)
      File "C:UsersserapAppDataLocalProgramsPythonPython310libsubprocess.py", line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\Scripts\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Users\serap\AppData\Local\Temp\tmpniofxxvj', '--quiet', 'numpy>=1.11']' returned non-zero exit status 1.

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersserapAppDataLocalTemppip-install-z6821kj4matplotlib_dd551371f0ba45a889cb056fa0e24291setup.py", line 236, in <module>
        setup(
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagessetuptools__init__.py", line 152, in setup
        _install_setup_requires(attrs)
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagessetuptools__init__.py", line 147, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagessetuptoolsdist.py", line 785, in fetch_build_eggs
        resolved_dists = pkg_resources.working_set.resolve(
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagespkg_resources__init__.py", line 766, in resolve
        dist = best[req.key] = env.best_match(
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagespkg_resources__init__.py", line 1051, in best_match
        return self.obtain(req, installer)
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagespkg_resources__init__.py", line 1063, in obtain
        return installer(requirement)
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagessetuptoolsdist.py", line 844, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "D:GitHubCodexGigasPythonCrashCoursechapter15.project-envlibsite-packagessetuptoolsinstaller.py", line 77, in fetch_build_egg
        raise DistutilsError(str(e)) from e
    distutils.errors.DistutilsError: Command '['D:\GitHub\CodexGigas\PythonCrashCourse\chapter15\.project-env\Scripts\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\Users\serap\AppData\Local\Temp\tmpniofxxvj', '--quiet', 'numpy>=1.11']' returned non-zero exit status 1.

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

    BUILDING MATPLOTLIB
      matplotlib: yes [3.2.2]
          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]
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]
             agg: yes [installing]
           tkagg: yes [installing; run-time loading from Python Tcl/Tk]
          macosx: no  [Mac OS-X only]

    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/9c/4b/06f4aa9bef6b5e4f177881b4dedd94faa6e7cb3d95dfaeaa8a1a8b541095/matplotlib-3.2.2.tar.gz#sha256=3d77a6630d093d74cbbfebaa0571d00790966be1ed204e4a8239f5cbd6835c5d (from https://pypi.org/simple/matplotlib/) (requires-python:>=3.6). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached matplotlib-3.2.1.tar.gz (40.3 MB)

Then, after the error message, the pip attempts to install matplotlib again, only to fail and repeat the same error message; as if it was caught in a continuously loop until I ended it!
Again, I didn’t have this issue with Python 3.9.6 therefore, I am assuming this has something to do with Python’s new release perhaps.

I also tried the following commands

  • pip install matplotlib
  • python3 install matplotlib

My Desired Solution

  1. I would like to know why am I getting the error message
  2. I would like to install and use matplotlib with Python 3.10 —> The easy way

Explain it to me like I am five-years old what am I doing wrong here?

Asked By: Seraph

||

Answers:

Not totally sure, but I ran into the same issue. After some digging and testing I think I’ve found out that Matplotlib, and pylab aren’t compatible with python3.10 yet. For the time being I’ve kept python3.9 along with 3.10 so whenever I use matplotlib, numpy, or pylab, I just use version 3.9.

Answered By: John

You need to switch to Python 3.8.

Use the following command to switch between the different alternatives:

sudo update-alternatives --config python3
Answered By: John Waweru