Closed
Description
I have a PyPI project named cbdep
where all versions depend on at least Python 3.10. If I run uv tool install cbdep
in a Linux environment where the system Python is < 3.10 and pip
is installed, uv
decides not to download a newer Python and instead fails with the error
× No solution found when resolving dependencies:
╰─▶ Because the current Python version (3.8.10) does not satisfy
Python>=3.10 and all versions of cbdep depend on Python>=3.10, we can
conclude that all versions of cbdep cannot be used.
And because you require cbdep, we can conclude that your requirements
are unsatisfiable.
Setting --python-preference=only-managed
allows this to work, but that means it will install Python even in an environment where Python 3.10+ is available which isn't optimal.
Here is a Dockerfile which demonstrates the problem, included the rather bizarre fact that it only occurs when the python3-pip
package is installed:
FROM ubuntu:20.04 AS base
RUN apt-get update && apt-get install -y python3 curl
RUN useradd -m testuser
USER testuser
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/home/testuser/.local/bin:${PATH}"
# This path works as expected
FROM base AS successful
RUN uv tool install cbdep
RUN ls -l ~/.local/share/uv/python
RUN touch /tmp/foo
# This path fails because uv decides not to download python
FROM base AS failure
USER root
RUN apt-get install -y python3-pip
# This line is only here to make `docker build` build the `successful` path
COPY --from=successful /tmp/foo /tmp/foo
USER testuser
RUN RUST_LOG=trace uv tool install cbdep
RUN ls -l ~/.local/share/uv/python
I wonder if this might be related in some way to #5144 ?