-
Notifications
You must be signed in to change notification settings - Fork 913
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
Python dev headers missing in venv #9347
Comments
Similar to #8966 (comment) TL;DR Try sysconfigpatcher to adjust the uv python downloads to have the proper pkgconfig and sysconfig metadata for your system. |
This doesn't quite make sense, we didn't change previous versions of uv and the Python distributions we use are hard-coded for each release and cannot change. |
If you're using a system interpreter, you should install the headers, e.g., the following works:
I can't reproduce this failure using a managed interpreter:
|
this works:
this doesn't
|
I am also having this issue, and using Docker is not a feasible workaround. Could UV not be modified so that installs the Python headers when creating a venv? |
👋 @wjakob, the docker examples here are to provide an MRE, you can apply the same steps outside of docker. |
This is on a machine where I don't have root access, hence installing the headers via |
@arogozhnikov your failing example uses the system interpreter (3.11 is installed in the image already)
That's why you need to install development headers via the system package manager. If you force uv to use a managed interpreter with
|
@wjakob please share a reproducible example |
Thanks @zanieb, I've been incorrectly under assumption OP wanted to use
Do you think it's worth expanding in docs when is it reasonable to attempt to use |
It's sort of a priority for me to understand the problems people are encountering and fix it here rather than recommend |
Here's one: FROM fedora:41
RUN dnf update -y && \
dnf group install -y 'development-tools' && \
dnf install -y \
gcc \
gcc-c++ \
gtk3 \
gtk3-devel \
libxcrypt-compat \
python3 \
python3-devel \
which
RUN curl -LsSf https://astral.sh/uv/install.sh | sh Run the resulting image then:
Then we go and look at the detailed logs
I can confirm that using sysconfigpatcher fixes this issue (the wxpython build takes a bit of an eternity, but it eventually does succeed)
Also worth noting that UV's manager isn't the only one that leads to these kinds of issues; back then I experienced a similar (but not the same exact) issue with pyenv+poetry, linked here https://gitlab.com/ita1024/waf/-/issues/2420 |
Thanks @Tristan971, I believe that one is a manifestation of astral-sh/python-build-standalone#374 which we're also tracking in #8429 The workaround for this is:
(with the proper path to the Python you're using) As you said it's taking forever to build so I can't confirm at this second, but it's definitely past that early failure. |
Great to see it’s already being looked at! :-) |
Gonna review this today to see if it's resolved with latest changes. |
If it's any help, this would still fail
|
@samypr100 You need to have a sane build setup (C++ dev environment) in your container. This is not related to the main issue, which was about the presence of Python headers. |
Thanks, note this is a |
I presume the point is that we'd need #9916 for that example to work? |
Yeah for me that's separate from this issue (though a good point from @samypr100). |
Confirmed that this works on latest (with |
My last example now also works as of 0.5.10 release without the need for > docker run --platform linux/x86_64 -it --rm ghcr.io/astral-sh/uv:0.5.10-bookworm /bin/bash -c "uv venv -p 3.11.10 && uv pip install ihm"
Using CPython 3.11.10
Creating virtual environment at: .venv
Resolved 2 packages in 406ms
Built ihm==1.8
Prepared 2 packages in 2.72s
Installed 2 packages in 2ms
+ ihm==1.8
+ msgpack==1.1.0 |
I think python dev headers are now missing when uv installs venv; repro (start from ubuntu 22.04):
confirmed on uv==0.5.0 and 0.5.4, not tested on other versions
output:
Annoyingly, it used to work - I was able to install this package, but a couple of weeks ago binaries shipped with uv were swapped for some other builds, this affected even previous versions of uv.
The text was updated successfully, but these errors were encountered: