question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No module named pre_commit

See original GitHub issue

After updating to latest version, I got an error “No module named pre_commit” when git commit: Does anyone know how to fix it?

.nixpkgs
❯ pre-commit --version
pre-commit 2.16.0

.nixpkgs on  master
❯ pre-commit install
pre-commit installed at .git/hooks/pre-commit

.nixpkgs on  master
❯ pre-commit run --all-files
Check Toml...............................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
black....................................................................Passed

.nixpkgs on  master
❯ git commit -m "Enable builtin pixel scrolling in Emacs 29"
/nix/store/x0fw0l4d6zwgfdwbpp23iwhm3c6a1hh3-python3-3.9.6/bin/python3.9: No module named pre_commit

I install pre-commit with nix on macOS.

This is my nix-config and .pre-commit-config.yaml

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
davidmpazcommented, Jul 17, 2022

Just in case someone stumble upon this. For me the solution during development was that I needed to install git hooks again in project.

After making myself sure that I was using the proper binaries. I was still having this issue until I ran: pre-commit install again

2reactions
asottilecommented, Dec 4, 2021

sounds like a bug in the nix packaging – since that works fine elsewhere

Read more comments on GitHub >

github_iconTop Results From Across the Web

ModuleNotFoundError: No module named 'pre-commit'
Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'pre-commit' How to remove the ModuleN.
Read more >
Uninstalled pre-commit preventing 'git commit' (pipenv)
This is preventing me from committing, and I have no idea where this is coming from, since pre-commit is not being installed. Further,...
Read more >
pre-commit
A framework for managing and maintaining multi-language pre-commit hooks. ... (optional) if true , this hook will run even if there are no...
Read more >
pre-commit - PyPI
A framework for managing and maintaining multi-language pre-commit hooks.
Read more >
tiangolo/fastapi - Gitter
Nevertheless, when I try to use add mypy in pre-commit I get this error: setup.cfg:27: error: Error importing plugin 'pydantic.mypy': No module named...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found