Search code examples
pythonimporterrorblack-code-formatter

Problem with using Black code formatter; can't import _ast3


I want to use "Black code formatter" for one of my python projects. I've successfully installed it with "pip install black", which gave an output in the cmd which showed that all requirements were already satisfied (including "typed-ast>1.4.0").

However, when I try to run the "black --help" after installation, I get the error: "ImportError: cannot import the name '_ast3' from 'typed_ast". Does anyone know what might be the issue here?


Solution

  • Try reinstalling and upgrading both typed-ast and black:

    pip install --force-reinstall --upgrade typed-ast black