Skip to content

[FIX] build.sh: Run pip without sudo - #243

Merged
moylop260 merged 1 commit into
Vauxoo:mainfrom
vauxoo-dev:main-t2d-uv-pip-path-moy
Oct 4, 2026
Merged

moylop260 merged 1 commit into
Vauxoo:mainfrom
vauxoo-dev:main-t2d-uv-pip-path-moy

Conversation

@moylop260

Copy link
Copy Markdown
Collaborator

Problem

Generating the scripts for a project that uses a uv managed python image, for example
BASE_IMAGE="vauxoo/odoo-190-image:2604-minimal" with ORCHESTSH_UV="True" (vauxoo/ircodoo 19.0), and running the generated 10-build.sh exits with code 2:

sudo: pip: command not found
ModuleNotFoundError: No module named 'pre_commit_vauxoo'
/bin/sh: 24: virtualenv: not found
/bin/sh: 25: .: cannot open /venev-pgcli/bin/activate: No such file
ERROR: failed to solve: process "/bin/sh -c . /home/odoo/build.sh && set_odoo_ids && install_dev_tools && ... install_pgcli_venv ..." did not complete successfully: exit code: 2

Cause

install_dev_tools calls sudo -E pip install twice (build.sh#L97-L107, build.sh#L118). The Dockerfile runs it as root, before USER odoo (Dockerfile_deployv#L25-L66), so sudo adds nothing except one effect: it replaces PATH with its secure_path. In that image pip lives in /opt/python/current/bin, which is on the image PATH but not in secure_path. -E keeps the environment variables, not the PATH.

The function has no set -e, so the failure is silent there and the build dies later in install_pgcli_venv (build.sh#L22-L28), far from the real error. Older images worked because their pip was in /usr/bin or /usr/local/bin.

Change

Run pip install directly. That keeps the environment -E was added for (PIP_BREAK_SYSTEM_PACKAGES, ef4be94) and the PATH of the image.

Tests

  • tests/test_travis2docker.py::test_build_sh_pip_without_sudo fails before the change (pip called through sudo in build.sh) and passes after. It is a static check: running install_dev_tools would run apt and write under /etc on the test host.
  • tox -e py: 8 passed.
  • End to end: regenerated with the fix and ran 10-build.sh for vauxoo/ircodoo 19.0 again, exit 0, image built. Inside it virtualenv, pre-commit-vauxoo and py-spy are in /opt/python/current/bin and /venev-pgcli/bin/pgcli exists.

tox -e lint fails the same way on a clean main, unrelated to build.sh and tests/: check-json on the Jinja template devcontainer.json, and ruff-odoo optional findings in git_run.py, travis2docker.py and docker_helper/build.py.

The Dockerfile executes build.sh as root, before "USER odoo", so
"sudo -E pip" only added one thing: sudo replaces PATH with its
secure_path. Images based on the uv managed python install pip under
/opt/python/current/bin, outside of secure_path, so both pip calls of
install_dev_tools failed with "sudo: pip: command not found".

The failure did not stop the function, and the build failed later in
install_pgcli_venv with "virtualenv: not found" (exit code 2), e.g.
generating the scripts for a project using
BASE_IMAGE="vauxoo/odoo-190-image:2604-minimal".

Calling pip directly keeps the environment (PIP_BREAK_SYSTEM_PACKAGES,
the reason of "-E") and the PATH of the image.
@moylop260
moylop260 marked this pull request as ready for review September 30, 2026 18:53
@moylop260
moylop260 merged commit 1ccf31e into Vauxoo:main Oct 4, 2026
14 of 20 checks passed
@moylop260
moylop260 deleted the main-t2d-uv-pip-path-moy branch October 4, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant