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

uv pip install --python <version> doesn't perform automatic Python downloads #12229

Open
kyluca opened this issue Mar 17, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@kyluca
Copy link

kyluca commented Mar 17, 2025

Summary

Hi,

Firstly, thank you for your incredible work and vision with uv and Astral as a whole.

I'm not entirely sure whether this is a bug or intended behaviour (if so, perhaps an extra note in the documentation would suffice). I've also tried to find existing issues that match the symptoms but haven't found any.

My use case is packaging dependencies into a zip archive for deployment to AWS Lambda via Terraform. Following the guide on https://docs.astral.sh/uv/guides/integration/aws-lambda/ is very helpful, particularly with the --target <target dir> feature as we previously used it with pip install directly. However, when the desired Python version doesn't exist on the system, uv doesn't attempt to download it.

My expectation was for uv to automatically download the missing Python version as it does with the majority of other uv workflows. Although, I can see this might intentionally not be the case with the "pip compatibility" layer as managing Python versions is not something that pip concerns itself with.

Is this the intended behaviour? I can of course run something like uv python install python3.13 before running the install command to make sure it's always present, or bake Python 3.13 into my Terraform agent itself. However, the way that uv usually manages to automatically download missing Python versions is a really great feature that I've come to rely on to as it removes the need to prepare system wide dependencies etc.

Steps to reproduce the bug

With a fresh clone of https://github.com/astral-sh/uv-aws-lambda-example, following the "Zip archive" steps at https://github.com/astral-sh/uv-aws-lambda-example?tab=readme-ov-file#zip-archive works as written assuming you already have Python 3.13 installed.

If you remove it first, the commands fail:

$ uv python uninstall 3.13
Searching for Python versions matching: Python 3.13
Uninstalled Python 3.13.0 in 116ms
 - cpython-3.13.0-linux-x86_64-gnu

$ uv export --frozen --no-dev --no-editable -o requirements.txt
# This file was autogenerated by uv via the following command:
#    uv export --frozen --no-dev --no-editable -o requirements.txt
annotated-types==0.7.0 \
    --hash=sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53 \
    --hash=sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89
anyio==4.7.0 \
    --hash=sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48 \
    --hash=sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352
<truncated>

$ uv pip install --no-installer-metadata --no-compile-bytecode --python-platform x86_64-manylinux2014 --python 3.13 --target packages -r requirements.txt --verbose
DEBUG uv 0.6.6
DEBUG Searching for Python 3.13 in virtual environments, managed installations, or search path
DEBUG Searching for managed installations at `/home/kyle/.local/share/uv/python`
DEBUG Found `cpython-3.10.12-linux-x86_64-gnu` at `/usr/bin/python3` (first executable in the search path)
DEBUG Skipping interpreter at `/usr/bin/python3` from first executable in the search path: does not satisfy request `3.13`
DEBUG Found `cpython-3.10.12-linux-x86_64-gnu` at `/usr/bin/python` (search path)
DEBUG Skipping interpreter at `/usr/bin/python` from search path: does not satisfy request `3.13`
DEBUG Found `cpython-3.10.12-linux-x86_64-gnu` at `/bin/python3` (search path)
DEBUG Skipping interpreter at `/bin/python3` from search path: does not satisfy request `3.13`
DEBUG Found `cpython-3.10.12-linux-x86_64-gnu` at `/bin/python` (search path)
DEBUG Skipping interpreter at `/bin/python` from search path: does not satisfy request `3.13`
error: No interpreter found for Python 3.13 in virtual environments, managed installations, or search path

Hope that all makes sense and thanks again.

Cheers,
Kyle

Platform

Ubuntu 22.04 x86_64

Version

uv 0.6.6

Python version

Python 3.13

@kyluca kyluca added the bug Something isn't working label Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant