'Python 3.9 Microsoft Visual C++ 14.0 or greater is required

so I recently upgraded to Python 3.9 and when trying to install some libraries - specifically pip install discord - I encountered the following error:

  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' 'c:\users\user\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\User\AppData\Local\Temp\tmprrfx0262'
       cwd: C:\Users\User\AppData\Local\Temp\pip-install-qj3xz8wb\multidict
  Complete output (40 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\multidict
  copying multidict\_abc.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_compat.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_base.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict_py.py -> build\lib.win-amd64-3.9\multidict
  copying multidict\__init__.py -> build\lib.win-amd64-3.9\multidict
  running egg_info
  writing multidict.egg-info\PKG-INFO
  writing dependency_links to multidict.egg-info\dependency_links.txt
  writing top-level names to multidict.egg-info\top_level.txt
  reading manifest file 'multidict.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files found matching 'multidict\_multidict.html'
  warning: no previously-included files found matching 'multidict\*.so'
  warning: no previously-included files found matching 'multidict\*.pyd'
  warning: no previously-included files found matching 'multidict\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'multidict.egg-info\SOURCES.txt'
  copying multidict\__init__.pyi -> build\lib.win-amd64-3.9\multidict
  copying multidict\_multidict.c -> build\lib.win-amd64-3.9\multidict
  copying multidict\py.typed -> build\lib.win-amd64-3.9\multidict
  creating build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\defs.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\dict.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\istr.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\iter.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\pair_list.h -> build\lib.win-amd64-3.9\multidict\_multilib
  copying multidict\_multilib\views.h -> build\lib.win-amd64-3.9\multidict\_multilib
  running build_ext
  building 'multidict._multidict' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for multidict
  Building wheel for yarl (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python39\python.exe' 'c:\users\user\appdata\local\programs\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\User\AppData\Local\Temp\tmp_na_hzow'
       cwd: C:\Users\User\AppData\Local\Temp\pip-install-qj3xz8wb\yarl
  Complete output (35 lines):
  **********************
  * Accellerated build *
  **********************
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.9
  creating build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_py.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\_url.py -> build\lib.win-amd64-3.9\yarl
  copying yarl\__init__.py -> build\lib.win-amd64-3.9\yarl
  running egg_info
  writing yarl.egg-info\PKG-INFO
  writing dependency_links to yarl.egg-info\dependency_links.txt
  writing requirements to yarl.egg-info\requires.txt
  writing top-level names to yarl.egg-info\top_level.txt
  reading manifest file 'yarl.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no previously-included files matching '*.pyc' found anywhere in distribution
  warning: no previously-included files matching '*.cache' found anywhere in distribution
  warning: no previously-included files found matching 'yarl\*.html'
  warning: no previously-included files found matching 'yarl\*.so'
  warning: no previously-included files found matching 'yarl\*.pyd'
  no previously-included directories found matching 'docs\_build'
  writing manifest file 'yarl.egg-info\SOURCES.txt'
  copying yarl\__init__.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.c -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyi -> build\lib.win-amd64-3.9\yarl
  copying yarl\_quoting_c.pyx -> build\lib.win-amd64-3.9\yarl
  copying yarl\py.typed -> build\lib.win-amd64-3.9\yarl
  running build_ext
  building 'yarl._quoting_c' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
  ERROR: Failed building wheel for yarl
Failed to build multidict yarl
ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly

Obviously I went to the link and downloaded the build tools and then checked the C++ part but after restarting my computer, re-installing visual studio, I am still encountering the same problem. I am wondering if there is a part in the installation process that I am missing out on or if I have messed something up. Any help appreciated.



Solution 1:[1]

  1. Open up visual studio installer and select modify build tools
  2. Go to individual components and make sure C++ 2019 Redistributable Update, C++ CMake tools for Windows, MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27), C++ AddressSanitizer (Experimental), C++ Build Tools core features, are checked.

If not check them and select modify. If you are on an ARM or ARM64 based system, replace MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27) with the ARM or ARM64 version.

Solution 2:[2]

Try to install Visual Studio: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=16, and Visual Studio C++ Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/. The problem should be fixed.

Make sure you have version 14+.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 unbeatable101
Solution 2