Summary
Hi,
my problem is similar to #675. We get No such file or directory (os error 2) with a python hook.
We're currently migrating our gitlab CI from pre-commit to prek . We use UV_SYSTEM_PYTHON, and XDG_CACHE_HOME to avoid having to download all dependencies for each execution. This worked fine with rust & python tools, but I have to say that when we tried pre-commit with uv, we got a similar issue pre-commit/pre-commit#2778
I guess it may be due to astral-sh/uv#10354. So, any idea how to use prek caching python dependencies on CI?
Willing to submit a PR?
Platform
Linux 6.17.0-5-generic x86_64 GNU/Linux
Version
prek 0.3.4
.pre-commit-config.yaml
---
default_language_version:
python: python3.14
repos:
- repo: https://github.com/executablebooks/mdformat
rev: 1.0.0
hooks:
- id: mdformat
priority: 10
exclude: docs/api/ # not really MDs, and indentation is important
2026-03-02T08:54:56.231224Z DEBUG prek: 0.3.4
2026-03-02T08:54:56.231245Z DEBUG Args: ["prek", "run", "--all-files", "-vvv"]
2026-03-02T08:54:56.233735Z TRACE get_root: close time.busy=2.44ms time.idle=33.1µs
2026-03-02T08:54:56.233757Z DEBUG Git root: /builds/avatar-cognition/sc-tools/sc-tools
2026-03-02T08:54:56.233785Z DEBUG Found workspace root at /builds/avatar-cognition/sc-tools/sc-tools
2026-03-02T08:54:56.233796Z TRACE Include selectors: 2026-03-02T08:54:56.233800Z TRACE Skip selectors:
2026-03-02T08:54:56.233871Z DEBUG discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}: Config file changed, invalidating cache path=/builds/avatar-cognition/sc-tools/sc-tools/.pre-commit-config.yaml
2026-03-02T08:54:56.233936Z DEBUG discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}: Performing fresh workspace discovery
2026-03-02T08:54:56.233965Z TRACE discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}:list_submodules{git_root="/builds/avatar-cognition/sc-tools/sc-tools"}: close time.busy=5.69µs time.idle=12.1µs
2026-03-02T08:54:56.234943Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-03-02T08:54:56.238193Z TRACE discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}: close time.busy=4.36ms time.idle=17.6µs
2026-03-02T08:54:56.238321Z TRACE Checking lock resource="store" path=/var/tmp/cache/42258486/1/prek/.lock
2026-03-02T08:54:56.238333Z DEBUG Acquired lock resource="store"
2026-03-02T08:54:56.238560Z TRACE Skipping pyproject.toml metadata extraction because language_version is already configured hook=mdformat
2026-03-02T08:54:56.238600Z DEBUG Hooks going to run: ["mdformat"]
2026-03-02T08:54:56.238723Z TRACE Executing /usr/local/bin/python3.14 -I -c import sys, json info = { "version": ".".join(map(str, sys.version_info[:3])), "base_exec_prefix": sys.base_exec_prefix, } print(json.dumps(info)) [...]
2026-03-02T08:54:56.253712Z DEBUG Found installed environment for hook mdformat at /var/tmp/cache/42258486/1/prek/hooks/python-REas2OqE8hQegcwIATfw
2026-03-02T08:54:56.253765Z TRACE Released lock path=/var/tmp/cache/42258486/1/prek/.lock
2026-03-02T08:54:56.253794Z TRACE collect_files:ls_files{cwd="/builds/avatar-cognition/sc-tools/sc-tools" path="/builds/avatar-cognition/sc-tools/sc-tools"}: Executing cd /builds/avatar-cognition/sc-tools/sc-tools && /usr/bin/git ls-files -z -- /builds/avatar-cognition/sc-tools/sc-tools
2026-03-02T08:54:56.256466Z TRACE collect_files:ls_files{cwd="/builds/avatar-cognition/sc-tools/sc-tools" path="/builds/avatar-cognition/sc-tools/sc-tools"}: close time.busy=454µs time.idle=2.23ms
2026-03-02T08:54:56.256485Z DEBUG collect_files: All files in the workspace: 282
2026-03-02T08:54:56.256510Z TRACE collect_files: close time.busy=524µs time.idle=2.21ms
2026-03-02T08:54:56.256588Z TRACE for_project{project=.}: close time.busy=21.6µs time.idle=8.07µs
2026-03-02T08:54:56.256596Z TRACE Files for project . after filtered: 282
2026-03-02T08:54:56.256609Z TRACE get_diff{path="/builds/avatar-cognition/sc-tools/sc-tools"}: Executing /usr/bin/git diff -- /builds/avatar-cognition/sc-tools/sc-tools
2026-03-02T08:54:56.259968Z TRACE get_diff{path="/builds/avatar-cognition/sc-tools/sc-tools"}: close time.busy=259µs time.idle=3.11ms
2026-03-02T08:54:56.259994Z DEBUG Running priority group with priority 10 with concurrency 48: ["mdformat"]
2026-03-02T08:54:56.262534Z TRACE for_hook{hook="mdformat"}: close time.busy=2.51ms time.idle=15.4µs
2026-03-02T08:54:56.262550Z TRACE Files for hook mdformat after filtered: 4
2026-03-02T08:54:56.262692Z TRACE run{hook_id=mdformat language=python}: Resolved command: mdformat
2026-03-02T08:54:56.262749Z TRACE run{hook_id=mdformat language=python}: Running mdformat total_files=4 concurrency=48
2026-03-02T08:54:56.262775Z TRACE run{hook_id=mdformat language=python}: Executing cd /builds/avatar-cognition/sc-tools/sc-tools && mdformat bin/README.md README.md ci/README.md bin/deploy/README.md
2026-03-02T08:54:56.264479Z TRACE run{hook_id=mdformat language=python}: close time.busy=1.90ms time.idle=22.7µs
Summary
Hi,
my problem is similar to #675. We get
No such file or directory (os error 2)with a python hook.We're currently migrating our gitlab CI from pre-commit to prek . We use UV_SYSTEM_PYTHON, and XDG_CACHE_HOME to avoid having to download all dependencies for each execution. This worked fine with rust & python tools, but I have to say that when we tried
pre-commitwithuv, we got a similar issue pre-commit/pre-commit#2778I guess it may be due to astral-sh/uv#10354. So, any idea how to use prek caching python dependencies on CI?
Willing to submit a PR?
Platform
Linux 6.17.0-5-generic x86_64 GNU/Linux
Version
prek 0.3.4
.pre-commit-config.yaml
2026-03-02T08:54:56.231224Z DEBUG prek: 0.3.4
2026-03-02T08:54:56.231245Z DEBUG Args: ["prek", "run", "--all-files", "-vvv"]
2026-03-02T08:54:56.233735Z TRACE get_root: close time.busy=2.44ms time.idle=33.1µs
2026-03-02T08:54:56.233757Z DEBUG Git root: /builds/avatar-cognition/sc-tools/sc-tools
2026-03-02T08:54:56.233785Z DEBUG Found workspace root at
/builds/avatar-cognition/sc-tools/sc-tools2026-03-02T08:54:56.233796Z TRACE Include selectors:
2026-03-02T08:54:56.233800Z TRACE Skip selectors:2026-03-02T08:54:56.233871Z DEBUG discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}: Config file changed, invalidating cache path=/builds/avatar-cognition/sc-tools/sc-tools/.pre-commit-config.yaml
2026-03-02T08:54:56.233936Z DEBUG discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}: Performing fresh workspace discovery
2026-03-02T08:54:56.233965Z TRACE discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}:list_submodules{git_root="/builds/avatar-cognition/sc-tools/sc-tools"}: close time.busy=5.69µs time.idle=12.1µs
2026-03-02T08:54:56.234943Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-03-02T08:54:56.238193Z TRACE discover{root="/builds/avatar-cognition/sc-tools/sc-tools" config=None refresh=false}: close time.busy=4.36ms time.idle=17.6µs
2026-03-02T08:54:56.238321Z TRACE Checking lock resource="store" path=/var/tmp/cache/42258486/1/prek/.lock
2026-03-02T08:54:56.238333Z DEBUG Acquired lock resource="store"
2026-03-02T08:54:56.238560Z TRACE Skipping pyproject.toml metadata extraction because language_version is already configured hook=mdformat
2026-03-02T08:54:56.238600Z DEBUG Hooks going to run: ["mdformat"]
2026-03-02T08:54:56.238723Z TRACE Executing
/usr/local/bin/python3.14 -I -c import sys, json info = { "version": ".".join(map(str, sys.version_info[:3])), "base_exec_prefix": sys.base_exec_prefix, } print(json.dumps(info)) [...]2026-03-02T08:54:56.253712Z DEBUG Found installed environment for hook
mdformatat/var/tmp/cache/42258486/1/prek/hooks/python-REas2OqE8hQegcwIATfw2026-03-02T08:54:56.253765Z TRACE Released lock path=/var/tmp/cache/42258486/1/prek/.lock
2026-03-02T08:54:56.253794Z TRACE collect_files:ls_files{cwd="/builds/avatar-cognition/sc-tools/sc-tools" path="/builds/avatar-cognition/sc-tools/sc-tools"}: Executing
cd /builds/avatar-cognition/sc-tools/sc-tools && /usr/bin/git ls-files -z -- /builds/avatar-cognition/sc-tools/sc-tools2026-03-02T08:54:56.256466Z TRACE collect_files:ls_files{cwd="/builds/avatar-cognition/sc-tools/sc-tools" path="/builds/avatar-cognition/sc-tools/sc-tools"}: close time.busy=454µs time.idle=2.23ms
2026-03-02T08:54:56.256485Z DEBUG collect_files: All files in the workspace: 282
2026-03-02T08:54:56.256510Z TRACE collect_files: close time.busy=524µs time.idle=2.21ms
2026-03-02T08:54:56.256588Z TRACE for_project{project=.}: close time.busy=21.6µs time.idle=8.07µs
2026-03-02T08:54:56.256596Z TRACE Files for project
.after filtered: 2822026-03-02T08:54:56.256609Z TRACE get_diff{path="/builds/avatar-cognition/sc-tools/sc-tools"}: Executing
/usr/bin/git diff -- /builds/avatar-cognition/sc-tools/sc-tools2026-03-02T08:54:56.259968Z TRACE get_diff{path="/builds/avatar-cognition/sc-tools/sc-tools"}: close time.busy=259µs time.idle=3.11ms
2026-03-02T08:54:56.259994Z DEBUG Running priority group with priority 10 with concurrency 48: ["mdformat"]
2026-03-02T08:54:56.262534Z TRACE for_hook{hook="mdformat"}: close time.busy=2.51ms time.idle=15.4µs
2026-03-02T08:54:56.262550Z TRACE Files for hook
mdformatafter filtered: 42026-03-02T08:54:56.262692Z TRACE run{hook_id=mdformat language=python}: Resolved command: mdformat
2026-03-02T08:54:56.262749Z TRACE run{hook_id=mdformat language=python}: Running mdformat total_files=4 concurrency=48
2026-03-02T08:54:56.262775Z TRACE run{hook_id=mdformat language=python}: Executing
cd /builds/avatar-cognition/sc-tools/sc-tools && mdformat bin/README.md README.md ci/README.md bin/deploy/README.md2026-03-02T08:54:56.264479Z TRACE run{hook_id=mdformat language=python}: close time.busy=1.90ms time.idle=22.7µs