I can't install libraries

Hello, each time i try to install librabies as matplotlib, i have the following error : “python setup.py egg_info did not run successfully.”. Yet, everything is update (python and pip), i tried all things i can find on internet but nothing happened. I’m trying to run my codes on vscode, ty for help !

Full error message :
"C:\Users\josep\AppData\Local\Programs\Python\Python311>pip install matplotlib
Collecting matplotlib
Using cached matplotlib-3.6.1.tar.gz (35.8 MB)
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [100 lines of output]
D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
error: subprocess-exited-with-error

    Getting requirements to build wheel did not run successfully.
    exit code: 1

    [40 lines of output]
    Traceback (most recent call last):
      File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
        main()
      File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 112, in get_requires_for_build_wheel
        backend = _build_backend()
      File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 77, in _build_backend
        obj = import_module(mod_path)
      File "D:\msys64\mingw64\lib\python3.9\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 850, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "C:\Users\josep\AppData\Local\Temp\pip-build-env-ucsham3e\overlay\lib\python3.9\site-packages\setuptools\__init__.py", line 242, in <module>
        monkey.patch_all()
      File "C:\Users\josep\AppData\Local\Temp\pip-build-env-ucsham3e\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 99, in patch_all
        patch_for_msvc_specialized_compiler()
      File "C:\Users\josep\AppData\Local\Temp\pip-build-env-ucsham3e\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 162, in patch_for_msvc_specialized_compiler
        patch_func(*msvc9('find_vcvarsall'))
      File "C:\Users\josep\AppData\Local\Temp\pip-build-env-ucsham3e\overlay\lib\python3.9\site-packages\setuptools\monkey.py", line 149, in patch_params
        mod = import_module(mod_name)
      File "D:\msys64\mingw64\lib\python3.9\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
      File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 850, in exec_module
      File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
      File "C:\Users\josep\AppData\Local\Temp\pip-build-env-ucsham3e\overlay\lib\python3.9\site-packages\setuptools\_distutils\msvc9compiler.py", line 295, in <module>
        raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
    distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error

  Getting requirements to build wheel did not run successfully.
  exit code: 1

  See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Traceback (most recent call last):
    File "D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\installer.py", line 82, in fetch_build_egg
      subprocess.check_call(cmd)
    File "D:\msys64\mingw64\lib\python3.9\subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['D:\\msys64\\mingw64\\bin\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\josep\\AppData\\Local\\Temp\\tmpttzjd_hy', '--quiet', 'numpy>=1.19']' 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 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\josep\AppData\Local\Temp\pip-install-s430bcc1\matplotlib_e0dd9510039d466faac96b9dd8d0343c\setup.py", line 260, in <module>
      setup(  # Finally, pass this all along to setuptools to do the heavy lifting.
    File "D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\__init__.py", line 86, in setup
      _install_setup_requires(attrs)
    File "D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\__init__.py", line 80, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\dist.py", line 875, in fetch_build_eggs
      resolved_dists = pkg_resources.working_set.resolve(
    File "D:\msys64\mingw64\lib\python3.9\site-packages\pkg_resources\__init__.py", line 789, in resolve
      dist = best[req.key] = env.best_match(
    File "D:\msys64\mingw64\lib\python3.9\site-packages\pkg_resources\__init__.py", line 1075, in best_match
      return self.obtain(req, installer)
    File "D:\msys64\mingw64\lib\python3.9\site-packages\pkg_resources\__init__.py", line 1087, in obtain
      return installer(requirement)
    File "D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\dist.py", line 945, in fetch_build_egg
      return fetch_build_egg(self, req)
    File "D:\msys64\mingw64\lib\python3.9\site-packages\setuptools\installer.py", line 84, in fetch_build_egg
      raise DistutilsError(str(e)) from e
  distutils.errors.DistutilsError: Command '['D:\\msys64\\mingw64\\bin\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\josep\\AppData\\Local\\Temp\\tmpttzjd_hy', '--quiet', 'numpy>=1.19']' returned non-zero exit status 1.

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

  BUILDING MATPLOTLIB
        python: yes [3.9.7 (default, Nov 21 2021, 22:02:56)  [GCC 11.2.0 64 bit
                    (AMD64)]]
      platform: yes [win32]
         tests: no  [skipping due to configuration]
        macosx: no  [Mac OS-X only]

  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details."

The traceback mentions Python 3.9, e.g.

File "D:\msys64\mingw64\lib\python3.9\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>

On Windows it’s recommended to use the Python Launcher py:

py -3.11 -m pip install matplotlib

I have it installed here on Python 3.11 on Windows without a problem.

2 Likes