Black: error: Microsoft Visual C++ 14.0 or greater is required

Created on 6 Oct 2020  路  5Comments  路  Source: psf/black

Hello!

I try to install black by using pip install black cmd on Python 3.9.0 and I get the belowing error message.

I have also tried pip install git+https://github.com/psf/black.git without success.

Version: 20.8b1
OS: Windows 10
Python: 3.9.0

Thanks for your help in advance.

    ERROR: Command errored out with exit status 1:
     command: 'c:\users\mozesa\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mozesa\\AppData\\Local\\Temp\\pip-install-nock8528\\typed-ast\\setup.py'"'"'; __file__='"'"'C:\\Users\\mozesa\\AppData\\Local\\Temp\\pip-install-nock8528\\typed-ast\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\mozesa\AppData\Local\Temp\pip-record-hflrdww0\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mozesa\appdata\local\programs\python\python39\Include\typed-ast'
         cwd: C:\Users\mozesa\AppData\Local\Temp\pip-install-nock8528\typed-ast\
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\ast27.py -> build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\ast3.py -> build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\conversions.py -> build\lib.win-amd64-3.9\typed_ast
    copying typed_ast\__init__.py -> build\lib.win-amd64-3.9\typed_ast
    package init file 'ast3\tests\__init__.py' not found (or not a regular file)
    creating build\lib.win-amd64-3.9\typed_ast\tests
    copying ast3\tests\test_basics.py -> build\lib.win-amd64-3.9\typed_ast\tests
    running build_ext
    building '_ast27' 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: Command errored out with exit status 1: 'c:\users\mozesa\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\mozesa\\AppData\\Local\\Temp\\pip-install-nock8528\\typed-ast\\setup.py'"'"'; __file__='"'"'C:\\Users\\mozesa\\AppData\\Local\\Temp\\pip-install-nock8528\\typed-ast\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\mozesa\AppData\Local\Temp\pip-record-hflrdww0\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mozesa\appdata\local\programs\python\python39\Include\typed-ast' Check the logs for full command output.
bug installation

Most helpful comment

This is due to typed-ast not having binary wheels uploaded for python3.9 + windows (yet). It's tracked here: https://github.com/python/typed_ast/issues/146

All 5 comments

It works if I use pip3.8 install black.

This is due to typed-ast not having binary wheels uploaded for python3.9 + windows (yet). It's tracked here: https://github.com/python/typed_ast/issues/146

Typed AST now has binary wheels for Python 3.9 + Windows. 馃殌

Our test GitHub Actions workflow has been using the typed-ast wheels on Windows + Python 3.9 so everything should be a-okay now :)

Thanks @hugovk for letting us know!

install the previous version of Python-3.8.6 and try this works fine.
there are some issues with python-3.9

Was this page helpful?
0 / 5 - 0 ratings

Related issues

underyx picture underyx  路  22Comments

bofm picture bofm  路  72Comments

ambv picture ambv  路  51Comments

spapanik picture spapanik  路  23Comments

kindjacket picture kindjacket  路  21Comments