Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sync to install to system python #7748

Open
nhumrich opened this issue Sep 27, 2024 · 1 comment
Open

Allow sync to install to system python #7748

nhumrich opened this issue Sep 27, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists question Asking for clarification or support

Comments

@nhumrich
Copy link

In docker environments, it's quite common to install all python packages to the system. Virtual environments are not needed because the current project is the only thing installed.

The docker documentation for UV recommends that you use the venv entrypoint for all container commands:

CMD ["/app/.venv/bin/python"]

However, this makes migrating to UV a bit harder when so many things already reference "python" directly in.

Also, using a virtual environment in these situations complicates the container, because devs now have to remember to use the .venv python always.

Would it be possible to install into the system during uv sync somehow. I assumed --python-preference only-system would do this, but that doesn't seem to prevent the creating of a virtual environment. uv pip install support --system, so its sort of strange that sync does not.

My current workaround is doing this in the dockerfile instead:

RUN --mount=from=ghcr.io/astral-sh/uv,source=/uv,target=/bin/uv \
    uv pip compile pyproject.toml -o requirements.txt && \
    uv pip install -r requirements.txt --system
@zanieb
Copy link
Member

zanieb commented Sep 28, 2024

See UV_PROJECT_ENVIRONMENT and #6834

@zanieb zanieb added question Asking for clarification or support duplicate This issue or pull request already exists labels Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants