Skip to content

"Failed to create Python virtual environment" because of unknown missing file #1707

@l0b0

Description

@l0b0

Summary

Just testing out prek with Nix, and it's working great locally. But in CI I get the following error:

error: Failed to install hook `pretty-format-ini`
  caused by: Failed to create Python virtual environment
  caused by: Run command `create venv` failed
  caused by: No such file or directory (os error 2)

Willing to submit a PR?

  • Yes — I’m willing to open a PR to fix this.

Platform

NixOS x86_64

Version

prek 0.3.0

.pre-commit-config.yaml

---
# Configuration file for pre-commit (https://pre-commit.com/).
# Please run `pre-commit run --all-files` when adding or changing entries.

# Put formatters before linters to avoid spurious error messages
repos:
  - repo: https://github.com/jamescherti/pre-commit-elisp
    rev: 1415c3c1f0dbad79abb3ec86a6158681a1ab681d # frozen: v1.0.8
    hooks:
      - id: elisp-check-parens
      - id: elisp-byte-compile
      - id: elisp-indent

  - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
    rev: 4380fbb73a154b5f5624794c1c78d9719ccc860f # frozen: v2.16.0
    hooks:
      - id: pretty-format-ini
        args: [--autofix]

  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
    hooks:
      - id: pretty-format-json
        args: [--autofix]
      - id: pretty-format-json
        args: [--autofix]
        files: ^includes/mcomix/.*\.conf$
        types: []

  - repo: https://gitlab.com/engmark/sort-hook
    rev: f7c2fa555b1c3a32132b9b1a8f2b852c919dd4e7 # frozen: v5
    hooks:
      - id: sort
        args: [--locale=en_NZ.UTF-8]
        files: ^(.*/\.gitignore|includes/(\.bash_history|darktable/(keyboardrc|shortcutsrc|shortcutsrc\.defaults)|repl-history))$
        stages: [pre-commit]
      - id: sort
        args:
          [
            "--sort-option=--field-separator=\t",
            --sort-option=--key=2,
            --sort-option=--key=1,
            --locale=en_NZ.UTF-8,
          ]
        files: ^(includes/\.XCompose)$
        stages: [pre-commit]

  - repo: local
    hooks:
      - id: treefmt
        name: treefmt
        entry: nix fmt
        pass_filenames: false
        require_serial: true
        language: system
        always_run: true

      # Linters
      - id: gitlint
        name: gitlint
        entry: gitlint
        args: [--fail-without-commits, --staged, --msg-filename]
        language: system
        stages: [commit-msg]

      - id: pathchk
        name: pathchk
        entry: pathchk
        args: [--portability]
        exclude: ^([a-zA-Z0-9._][a-zA-Z0-9._-]+)(/[a-zA-Z0-9._][a-zA-Z0-9._-]+)*$ # https://lists.gnu.org/archive/html/coreutils/2023-01/msg00006.html
        language: system
        stages: [pre-commit]

  - repo: https://gitlab.com/engmark/shellcheck-gitlab-ci-scripts-hook
    rev: 48adb4e0b14aad9d657771ff0720b592652d266b # frozen: v2
    hooks:
      - id: shellcheck-gitlab-ci-scripts
        files: ^\.gitlab-ci\.yml$

  - repo: meta
    hooks:
      - id: check-useless-excludes

Log file

From the latest test run:

2026-02-28T21:47:40.601550Z DEBUG prek: 0.3.0
2026-02-28T21:47:40.601579Z DEBUG Args: ["prek", "-vvv", "run", "--all-files"]
2026-02-28T21:47:40.603074Z TRACE get_root: close time.busy=1.42ms time.idle=28.8µs
2026-02-28T21:47:40.603121Z DEBUG Git root: /builds/engmark/root
2026-02-28T21:47:40.603172Z DEBUG Found workspace root at `/builds/engmark/root`
2026-02-28T21:47:40.603203Z TRACE Include selectors: ``
2026-02-28T21:47:40.603233Z TRACE Skip selectors: ``
2026-02-28T21:47:40.603317Z DEBUG discover{root="/builds/engmark/root" config=None refresh=false}: Performing fresh workspace discovery
2026-02-28T21:47:40.603432Z TRACE discover{root="/builds/engmark/root" config=None refresh=false}:list_submodules{git_root="/builds/engmark/root"}: close time.busy=5.91µs time.idle=26.9µs
2026-02-28T21:47:40.604751Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-02-28T21:47:40.607319Z TRACE discover{root="/builds/engmark/root" config=None refresh=false}: close time.busy=4.04ms time.idle=28.3µs
2026-02-28T21:47:40.607568Z TRACE Checking lock resource="store" path=/root/.cache/prek/.lock
2026-02-28T21:47:40.607700Z DEBUG Acquired lock resource="store"
2026-02-28T21:47:40.607907Z DEBUG Bootstrapping config tracking from workspace cache count=1
2026-02-28T21:47:40.608292Z DEBUG Cloning repo target=/root/.cache/prek/scratch/.tmp3lPnYz repo=https://github.com/jamescherti/pre-commit-elisp@1415c3c1f0dbad79abb3ec86a6158681a1ab681d
2026-02-28T21:47:40.608357Z TRACE Executing `/nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git -c init.defaultObjectFormat= init --template= /root/.cache/prek/scratch/.tmp3lPnYz`
2026-02-28T21:47:40.608778Z DEBUG Cloning repo target=/root/.cache/prek/scratch/.tmp6VzrOD repo=https://github.com/macisamuele/language-formatters-pre-commit-hooks@4380fbb73a154b5f5624794c1c78d9719ccc860f
2026-02-28T21:47:40.608801Z TRACE Executing `/nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git -c init.defaultObjectFormat= init --template= /root/.cache/prek/scratch/.tmp6VzrOD`
2026-02-28T21:47:40.612111Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp3lPnYz && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git remote add origin https://github.com/jamescherti/pre-commit-elisp`
2026-02-28T21:47:40.613718Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6VzrOD && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git remote add origin https://github.com/macisamuele/language-formatters-pre-commit-hooks`
2026-02-28T21:47:40.614737Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp3lPnYz && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git fetch origin 1415c3c1f0dbad79abb3ec86a6158681a1ab681d --depth=1`
2026-02-28T21:47:40.615991Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6VzrOD && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git fetch origin 4380fbb73a154b5f5624794c1c78d9719ccc860f --depth=1`
2026-02-28T21:47:40.785455Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp3lPnYz && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git checkout FETCH_HEAD`
2026-02-28T21:47:40.791710Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp3lPnYz && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git submodule update --init --recursive --depth=1`
2026-02-28T21:47:40.805389Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6VzrOD && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git checkout FETCH_HEAD`
2026-02-28T21:47:40.819066Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6VzrOD && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git submodule update --init --recursive --depth=1`
2026-02-28T21:47:40.826582Z DEBUG Cloning repo target=/root/.cache/prek/scratch/.tmpPU5O8R repo=https://github.com/pre-commit/pre-commit-hooks@3e8a8703264a2f4a69428a0aa4dcb512790b2c8c
2026-02-28T21:47:40.826754Z TRACE Executing `/nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git -c init.defaultObjectFormat= init --template= /root/.cache/prek/scratch/.tmpPU5O8R`
2026-02-28T21:47:40.830651Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpPU5O8R && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git remote add origin https://github.com/pre-commit/pre-commit-hooks`
2026-02-28T21:47:40.832946Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpPU5O8R && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git fetch origin 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c --depth=1`
2026-02-28T21:47:40.852690Z DEBUG Cloning repo target=/root/.cache/prek/scratch/.tmp6PrE3Y repo=https://gitlab.com/engmark/sort-hook@f7c2fa555b1c3a32132b9b1a8f2b852c919dd4e7
2026-02-28T21:47:40.852723Z TRACE Executing `/nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git -c init.defaultObjectFormat= init --template= /root/.cache/prek/scratch/.tmp6PrE3Y`
2026-02-28T21:47:40.856076Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6PrE3Y && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git remote add origin https://gitlab.com/engmark/sort-hook`
2026-02-28T21:47:40.858172Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6PrE3Y && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git fetch origin f7c2fa555b1c3a32132b9b1a8f2b852c919dd4e7 --depth=1`
2026-02-28T21:47:41.003399Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpPU5O8R && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git checkout FETCH_HEAD`
2026-02-28T21:47:41.012403Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpPU5O8R && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git submodule update --init --recursive --depth=1`
2026-02-28T21:47:41.039283Z DEBUG Cloning repo target=/root/.cache/prek/scratch/.tmpoGwixj repo=https://gitlab.com/engmark/shellcheck-gitlab-ci-scripts-hook@48adb4e0b14aad9d657771ff0720b592652d266b
2026-02-28T21:47:41.039317Z TRACE Executing `/nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git -c init.defaultObjectFormat= init --template= /root/.cache/prek/scratch/.tmpoGwixj`
2026-02-28T21:47:41.042652Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpoGwixj && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git remote add origin https://gitlab.com/engmark/shellcheck-gitlab-ci-scripts-hook`
2026-02-28T21:47:41.044667Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpoGwixj && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git fetch origin 48adb4e0b14aad9d657771ff0720b592652d266b --depth=1`
2026-02-28T21:47:41.658621Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6PrE3Y && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git checkout FETCH_HEAD`
2026-02-28T21:47:41.663930Z TRACE Executing `cd /root/.cache/prek/scratch/.tmp6PrE3Y && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git submodule update --init --recursive --depth=1`
2026-02-28T21:47:41.845758Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpoGwixj && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git checkout FETCH_HEAD`
2026-02-28T21:47:41.851030Z TRACE Executing `cd /root/.cache/prek/scratch/.tmpoGwixj && /nix/store/0457bm8a5pr00p1wd4zpdz0307wqdnw0-git-with-svn-2.52.0/bin/git submodule update --init --recursive --depth=1`
2026-02-28T21:47:41.875350Z DEBUG Hooks going to run: ["elisp-check-parens", "elisp-byte-compile", "elisp-indent", "pretty-format-ini", "pretty-format-json", "pretty-format-json", "sort", "sort", "treefmt", "pathchk", "shellcheck-gitlab-ci-scripts", "check-useless-excludes"]
2026-02-28T21:47:41.875530Z DEBUG Hook `elisp-check-parens` does not need installation
2026-02-28T21:47:41.875564Z DEBUG Hook `elisp-byte-compile` does not need installation
2026-02-28T21:47:41.875576Z DEBUG Hook `elisp-indent` does not need installation
2026-02-28T21:47:41.875604Z DEBUG Hook `sort` does not need installation
2026-02-28T21:47:41.875616Z DEBUG Hook `sort` does not need installation
2026-02-28T21:47:41.875628Z DEBUG Hook `shellcheck-gitlab-ci-scripts` does not need installation
2026-02-28T21:47:41.875670Z DEBUG Hook `treefmt` does not need installation
2026-02-28T21:47:41.875698Z DEBUG Hook `pathchk` does not need installation
2026-02-28T21:47:41.875712Z DEBUG Hook `check-useless-excludes` is a meta or builtin hook, no installation needed
2026-02-28T21:47:41.876698Z TRACE Checking lock resource="uv" path=/root/.cache/prek/tools/uv/.lock
2026-02-28T21:47:41.876712Z TRACE Checking lock resource="uv" path=/root/.cache/prek/tools/uv/.lock
2026-02-28T21:47:41.876939Z DEBUG Acquired lock resource="uv"
2026-02-28T21:47:41.876977Z  INFO Waiting to acquire lock resource="uv" path=/root/.cache/prek/tools/uv/.lock
2026-02-28T21:47:41.927639Z TRACE Selected uv source source=PyPi(Pypi)
2026-02-28T21:47:41.927689Z DEBUG Fetching uv metadata from: https://pypi.org/pypi/uv/0.9.21/json
2026-02-28T21:47:42.000262Z DEBUG Downloading url=https://files.pythonhosted.org/packages/1a/f0/aa3d0081a2004050564364a1ef3277ddf889c9989a7278c0a9cce8284926/uv-0.9.21-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl temp_dir="/root/.cache/prek/scratch/.tmp6bSsr1"
2026-02-28T21:47:42.331587Z DEBUG Moving uv to target extracted_uv="/root/.cache/prek/scratch/.tmp6bSsr1/uv-0.9.21.data/scripts/uv" target=/root/.cache/prek/tools/uv/uv
2026-02-28T21:47:42.332501Z TRACE Released lock path=/root/.cache/prek/tools/uv/.lock
2026-02-28T21:47:42.332727Z TRACE Acquired lock resource="uv"
2026-02-28T21:47:42.332741Z DEBUG Installing environment hook=pretty-format-ini target=/root/.cache/prek/hooks/python-13Lh6mPdUagOhbqYzR6W
2026-02-28T21:47:42.332796Z TRACE Executing `/root/.cache/prek/tools/uv/uv venv /root/.cache/prek/hooks/python-13Lh6mPdUagOhbqYzR6W --python-preference managed --no-project --project / --no-python-downloads [...]`
2026-02-28T21:47:42.333383Z DEBUG Failed to create venv `/root/.cache/prek/hooks/python-13Lh6mPdUagOhbqYzR6W`: Run command `create venv` failed
2026-02-28T21:47:42.333665Z TRACE Released lock path=/root/.cache/prek/.lock

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions