pre-commit: update to Python 3.10, pre-commit fails
describe your issue
Since I updated my Ubuntu 22.04 machine to Python 3.10, pre-commit gets in my way and I can’t figure out what to do. When trying to git commit
on a Python project, pre-commit won’t let me with the error message
[INFO] Initializing environment for https://github.com/PyCQA/isort.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/PyCQA/flake8.
[INFO] Installing environment for https://github.com/PyCQA/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
Check the log at /home/nschloe/.cache/pre-commit/pre-commit.log
See below for the log data.
I’m guessing there’s an old cache somewhere, but
pre-commit clean
didn’t help. Any other idea?
pre-commit --version
pre-commit 2.18.1
.pre-commit-config.yaml
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
~/.cache/pre-commit/pre-commit.log (if present)
version information
pre-commit version: 2.18.1
git --version: git version 2.34.1
sys.version:
3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]
sys.executable: /usr/bin/python3
os.name: posix
sys.platform: linux
error information
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
Traceback (most recent call last):
File "/home/nschloe/.local/lib/python3.10/site-packages/pre_commit/error_handler.py", line 73, in error_handler
yield
File "/home/nschloe/.local/lib/python3.10/site-packages/pre_commit/main.py", line 343, in main
return hook_impl(
File "/home/nschloe/.local/lib/python3.10/site-packages/pre_commit/commands/hook_impl.py", line 237, in hook_impl
return retv | run(config, store, ns)
File "/home/nschloe/.local/lib/python3.10/site-packages/pre_commit/commands/run.py", line 414, in run
install_hook_envs(to_install, store)
File "/home/nschloe/.local/lib/python3.10/site-packages/pre_commit/repository.py", line 221, in install_hook_envs
_hook_install(hook)
File "/home/nschloe/.local/lib/python3.10/site-packages/pre_commit/repository.py", line 83, in _hook_install
raise AssertionError(
AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 29 (15 by maintainers)
alright it’s available: https://launchpad.net/~deadsnakes/+archive/ubuntu/python3.10-jammy
I don’t, personally I only care about ubuntu and the debian bug reporting process is a pain the ass so I didn’t bother and just contacted the devs directly (haven’t heard back)
but actually don’t bother, 20.4.6 is way too old to work properly
upgrade virtualenv, purge
~/.local/share/virtualenv
and you should be good to goThanks!
I can also manually apply the patch to
/usr/lib/python3.10/sysconfig.py
locally and wait for the future.olol, it’s just me 🙃
maybe I’ll make the 3.10-jammy ppa then
idk if there’s anywhere it’s publicly posted – I have some direct contacts with the maintainers
deadsnakes typically only publishes LTS packages and since jammy isn’t finalized yet I haven’t built packages for it (I also typically don’t repackage pythons provided by ubuntu itself, but I may make a separate PPA for jammy-3.10 with this patch applied on top of upstream)
I suspect the actual duplicate is #2299