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

VIRTUAL_ENV=/usr/local in dockerfile stopped working for uv 0.2 (error: No Python interpreters found in virtual environments) #3787

Closed
przecze opened this issue May 23, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists question Asking for clarification or support

Comments

@przecze
Copy link

przecze commented May 23, 2024

this used to work:

FROM python:3.11-slim-bookworm

ENV VIRTUAL_ENV=/usr/local
RUN pip install --no-cache-dir uv && \
    uv pip install --no-cache-dir pandas

but now it results in

error: No Python interpreters found in virtual environments

I was able to pin it down to recent uv 0.2 release, namely:
this works

FROM python:3.11-slim-bookworm

ENV VIRTUAL_ENV=/usr/local
RUN pip install --no-cache-dir "uv<0.2" && \
    uv pip install --no-cache-dir pandas

but this throws the error:

FROM python:3.11-slim-bookworm

ENV VIRTUAL_ENV=/usr/local
RUN pip install --no-cache-dir "uv>=0.2" && \
    uv pip install --no-cache-dir pandas

Output with verbose:

Step 3/3 : RUN pip install --no-cache-dir "uv>=0.2" &&     uv pip install --verbose --no-cache-dir pandas
 ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in f211bab5e4dc
Collecting uv>=0.2
  Downloading uv-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (32 kB)
Downloading uv-0.2.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.0/13.0 MB 24.3 MB/s eta 0:00:00
Installing collected packages: uv
Successfully installed uv-0.2.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
DEBUG Searching for interpreter that fulfills Python @ default
DEBUG Searching for interpreter that fulfills Python @ default
INFO Found active virtual environment (via VIRTUAL_ENV) at: /usr/local
DEBUG Ignoring Python interpreter at `/usr/local/bin/python`: system intepreter not allowed
error: No Python interpreters found in virtual environments

Looks like system interpreter not allowed is the root cause in v0.2, how to work around it in Dockerfile?

@przecze
Copy link
Author

przecze commented May 23, 2024

note: seems to be fixed by adding the --system flag in uv pip install instead of VIRTUAL_ENV

@zanieb
Copy link
Member

zanieb commented May 23, 2024

Hi! This is a duplicate of #3782 and #3765.

I think it's better to opt-in to system modification than to pretend you're in a virtual environment.

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
@zanieb zanieb added duplicate This issue or pull request already exists question Asking for clarification or support labels May 23, 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