Repository navigation
Closed
Labels
Description
Looks like a call to python is hard coded when it shouldn't be.
β³ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/asottile/pyupgrade.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/pycqa/flake8.
[INFO] Initializing environment for https://github.com/codespell-project/codespell.
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout:
Executable `python` not found
stderr: (none)
Check the log at /home/russ/.cache/pre-commit/pre-commit.log
Running on Ubuntu jammy with python 3.10. /usr/bin/python does not exist.
version information
pre-commit version: 2.17.0
git --version: git version 2.34.1
sys.version:
3.10.3 (main, Mar 16 2022, 17:19:40) [GCC 11.2.0]
sys.executable: /usr/bin/python3
os.name: posix
sys.platform: linux
error information
An unexpected error has occurred: CalledProcessError: command: ('python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout:
Executable `python` not found
stderr: (none)
Traceback (most recent call last):
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/error_handler.py", line 70, in error_handler
yield
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/main.py", line 396, in main
return run(args.config, store, args)
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/commands/run.py", line 416, in run
install_hook_envs(to_install, store)
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/repository.py", line 224, in install_hook_envs
_hook_install(hook)
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/repository.py", line 82, in _hook_install
lang.install_environment(
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/languages/python.py", line 205, in install_environment
helpers.run_setup_cmd(prefix, install_cmd)
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/languages/helpers.py", line 52, in run_setup_cmd
cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
File "/home/russ/.local/lib/python3.10/site-packages/pre_commit/util.py", line 154, in cmd_output_b
raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
stdout:
Executable `python` not found
stderr: (none)
Reacted by Nico SchlΓΆmer, John T. Wodder II, swiss-knight and Matt Davis
Activity
asottile commentedon Mar 22, 2022
are you perhaps on debian unstable?
python+virtualenvis known to be (completely) broken there forpython3.10this should work:
if it does not I'd recommend reporting to your distribution packager
russkel commentedon Mar 22, 2022
It's on Ubuntu 22.04 so yes, some kind of unstable.
Okay, didn't realise it was supposed to be running from an venv at this point. Annoying stuff.
Thanks.
asottile commentedon Mar 22, 2022
if you want to follow the long bpo thread here's where to start: https://bugs.python.org/issue45413
I implemented a fix for deadsnakes for this but debian hasn't chosen their approach yet
asottile commentedon Apr 13, 2022
fwiw I've made a temporary ppa repackaging python3.10 for jammy using the same patch as python3.10 for other deadsnakes distributions -- https://launchpad.net/~deadsnakes/+archive/ubuntu/python3.10-jammy
russkel commentedon Apr 13, 2022
Thanks a lot for that @asottile. I will install. I wish ubuntu would get it sorted already.
epigramx commentedon Sep 22, 2022
This problem returned at large for the common user, because 22.04.1 LTS updated its python to 3.10.6. Is there a new workaround?
asottile commentedon Sep 22, 2022
please email the debian maintainers, I've tried but they aren't convinced this is actually worth fixing
epigramx commentedon Sep 22, 2022
It makes pre-commit unusable for the largest distributions of Linux. Did someone link them this issue?
Is there a workaround with environmental variables etc. without having someone build python?
asottile commentedon Sep 22, 2022
(1) yes (2) yes see the linked issues
epigramx commentedon Sep 23, 2022
@asottile I don't get it, because I applied the patch from here at
/usr/lib/python3.10/sysconfig.py, and I see no change while it was working with your ppa.asottile commentedon Sep 23, 2022
you will need to purge virtualenv's cache afterwards as it does not know to invalidate in that case
asottile commentedon Sep 23, 2022
yeah you won't have to delete pre-commit's cache -- it has self-healing stuff for this already
epigramx commentedon Sep 23, 2022
hm alright, it needed a purge of
~/.local/share/virtualenv/as well and not just a purge of a local.envin question, thanks.