Skip to content

ModuleNotFoundError: toml with 'black' hook #863

@jaraco

Description

@jaraco

I have this config:

panman master $ cat .pre-commit-config.yaml
repos:
-   repo: https://github.com/ambv/black
    rev: stable
    hooks:
    - id: black
      language_version: python3.6

And I've pip-installed the latest pre-commit 1.12.0 to the Python 3.7.1 environment, but when I run pre-commit, it fails thus:

panman master $ pre-commit run --all-files
black....................................................................Failed
hookid: black

Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/bin/black", line 7, in <module>
    from black import main
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/lib/python3.6/site-packages/black.py", line 41, in <module>
    import toml
ModuleNotFoundError: No module named 'toml'
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/bin/black", line 7, in <module>
    from black import main
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/lib/python3.6/site-packages/black.py", line 41, in <module>
    import toml
ModuleNotFoundError: No module named 'toml'
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/bin/black", line 7, in <module>
    from black import main
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/lib/python3.6/site-packages/black.py", line 41, in <module>
    import toml
ModuleNotFoundError: No module named 'toml'
Traceback (most recent call last):
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/bin/black", line 7, in <module>
    from black import main
  File "/Users/jaraco/.cache/pre-commit/repoogmwxpko/py_env-python3.6/lib/python3.6/site-packages/black.py", line 41, in <module>
    import toml
ModuleNotFoundError: No module named 'toml'

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions