pre-commit: import yaml ModuleNotFoundError: No module named 'yaml'

search tried in the issue tracker

yes

describe your issue

When trying to commit changes via Pycharm, while having pre-commit install, I get this error caused in the util.py file: import yaml ModuleNotFoundError: No module named 'yaml'

pre-commit --version

pre-commit 2.19.0

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.2.0
    hooks:
      - id: check-docstring-first
      - id: end-of-file-fixer
      - id: trailing-whitespace
  - repo: https://github.com/asottile/setup-cfg-fmt
    rev: v1.20.1
    hooks:
      - id: setup-cfg-fmt
  - repo: https://github.com/PyCQA/isort
    rev: 5.10.1
    hooks:
      - id: isort
  - repo: https://github.com/asottile/pyupgrade
    rev: v2.32.1
    hooks:
      - id: pyupgrade
        args: [--py38-plus, --keep-runtime-typing]
  - repo: https://github.com/myint/autoflake
    rev: v1.4
    hooks:
      - id: autoflake
        args: ["--in-place", "--remove-all-unused-imports"]
  - repo: https://github.com/psf/black
    rev: 22.3.0
    hooks:
      - id: black
  - repo: https://github.com/PyCQA/flake8
    rev: 4.0.1
    hooks:
      - id: flake8
        additional_dependencies: [flake8-typing-imports>=1.9.0]
  - repo: https://github.com/tlambert03/napari-plugin-checks
    rev: v0.2.0
    hooks:
      - id: napari-plugin-checks
  # https://mypy.readthedocs.io/en/stable/introduction.html
  # you may wish to add this as well!
  # - repo: https://github.com/pre-commit/mirrors-mypy
  #   rev: v0.910-1
  #   hooks:
  #     - id: mypy

~/.cache/pre-commit/pre-commit.log (if present)

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

stop eating my time and show the output I can’t see your screen

wellllllll admittedly fedora is the special snowflake here – every other linux I’ve tried always installs to lib even on 32bit and 64bit

are you on fedora? I see a lot of mentions of fedora and similar problems – seems like they configure lib and lib64 which is strange and pycharm doesn’t understand it ?

Requirement already satisfied: pyyaml>=5.1 in ./venv/lib64/python3.9/site-packages (from pre-commit) (6.0)

venv/lib64 – something is wrong with your python setup – that should be venv/lib