Unable to install pre-commit hooks in Codex container

My Codex setup script:

python -m pip install -r BE/requirements.txt
pre-commit install --install-hooks

Fails with code 127:

/tmp/d3KTOV-setup_script.sh: line 8: pre-commit: command not found

How can we install scripts in such a way that they are in the “PATH” for the environment?

Try using /root/.pyenv/versions/3.12.10/bin/pre-commit install --install-hooks

I don’t know a way to do this without needing to hardcode the version in your set up script.