I am working on new project and installed pre-commit using:
python -m pip install pre-commit
within my created environment (i.e. a python=3.9
env)
When I run pre-commit
, I had an incompatibility version issue between blue
and pre-commit
:
The hook `blue` requires pre-commit version 2.9.2 but version 1.15.2 is installed.
I run pre-commit --version
to check the installed version, and it is 1.15.2
.
I run which -a pre-commit
and two pre-commit paths are shown:
/home/betty/anaconda3/envs/ceqa-py39/bin/pre-commit
/snap/bin/pre-commit
I uninstalled the pre-commit installed by snap
using this command sudo snap remove --purge pre-commit
but when running pre-commit in my project directory and in my environment, it still points to snap version of pre-commit, giving me this error:
bash: /snap/bin/pre-commit: No such file or directory
My question is how to be able to use the pre-commit
installed via pip
, rather than the one installed by snap
?
I changed the value of variable INSTALL_PYTHON
from /snap/pre-commit/51/usr/bin/python3
to /home/betty/anaconda3/envs/ceqa-py39/bin/pre-commit
in the pre-commit
file in my project directory /home/betty/random/memory-assisted-ceqa/.git/hooks/pre-commit
, but it is still not working.
Any thoughts?
likely you need to run hash -r
in your current shell (or simply start a new one). additionally a new run of pre-commit install
will replace the contents of INSTALL_PYTHON
with the correct value
the installed pre-commit scripts are the only places pre-commit itself stores any paths
I should really work with snap to remove that -- it's always been pretty outdated :(
disclaimer: I wrote pre-commit