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 lock creates a lockfile that can't be installed #12241

Open
s-banach opened this issue Mar 17, 2025 · 6 comments
Open

uv lock creates a lockfile that can't be installed #12241

s-banach opened this issue Mar 17, 2025 · 6 comments
Assignees
Labels
question Asking for clarification or support

Comments

@s-banach
Copy link

s-banach commented Mar 17, 2025

Question

Basic question

My pyproject.toml specifies python >= 3.11.
My actual .venv has python 3.12.
When I run uv lock, it creates a lockfile that works for python 3.11, but fails for python 3.12.
Is this the intended behavior?

Specific details

My company has our own internal pypi index. It has some oddities.
For example, numpy==2.2.4 is available for python 3.11, but not yet available for newer versions of python.
If I run uv lock, it creates a lockfile that specifies numpy==2.2.4.
If uv chose numpy==2.2.3 instead, it would be installable on 3.11, 3.12, 3.13.

Why I'm confused.

The uv.lock file lists various wheels for python 3.11, 3.12, 3.13, so it seems to be trying to build a lockfile that works for those three versions. But the lockfile it eventually produces can't be installed on any version except 3.11.

Platform

No response

Version

No response

@s-banach s-banach added the question Asking for clarification or support label Mar 17, 2025
@charliermarsh
Copy link
Member

There's a fairly thorough write-up on this problem here: https://docs.astral.sh/uv/concepts/resolution/#required-environments

@s-banach
Copy link
Author

Thanks!
It seemingly ignored the following two arguments that I tried for required-environments:

"platform_system == 'Windows' and python_version == '3.12'"
"sys_platform == 'win32' and python_version == '3.12'"

(Not sure why, I believe they should be correct.)

But eventually it worked with this argument:

"sys_platform == 'win_amd64' and python_version == '3.12'"

@s-banach
Copy link
Author

Actually, it just builds the same lock file, but adds a section for win_64 with numpy-2.2.3.tar.gz instead of wheels.
Idk, I can't make it work.

@charliermarsh
Copy link
Member

I don't think we look at python_version at all in that setting. There's an open issue tracking it. I can look at it soon. You should really just pin numpy to PyPI rather than getting it from your own repository via an explicit index source?

@s-banach
Copy link
Author

I'm sorry for wasting your time with stupid stuff. My company blocks pypi, we have our "internal pypi" which has some bogus security scanner that blocks certain versions.

@charliermarsh
Copy link
Member

That's ok, I understand. Let me re-open.

@charliermarsh charliermarsh reopened this Mar 17, 2025
@charliermarsh charliermarsh self-assigned this Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants