Skip to content

Managed Python sysconfig returns incorrect path to CC on Amazon Linux 2023 #12901

@nwalters512

Description

@nwalters512

Summary

This simplest way to reproduce this is to build the following simple Docker image:

FROM amazonlinux:2023

RUN dnf install -y gcc g++ tar

RUN curl -LO https://astral.sh/uv/install.sh \
    && sh install.sh \
    && rm install.sh \
    && source $HOME/.local/bin/env \
    && uv version \
    && uv venv --python 3.10 \
    && source ./.venv/bin/activate \
    && python3 -c 'import sysconfig; print(sysconfig.get_config_var("CC"))'

That ultimately logs /usr/bin/aarch64-linux-gnu-gcc, but on this system, the correct path is /usr/bin/aarch64-amazon-linux-gcc.

If we add the following command, we can see that CC indeed points at the wrong path:

cat /root/.local/share/uv/python/cpython-3.10.17-linux-aarch64-gnu/lib/python3.10/_sysconfigdata__linux_aarch64-linux-gnu.py
# system configuration generated and used by the sysconfig module
build_time_vars = {
    # omitted for brevity...
    "CC": "/usr/bin/aarch64-linux-gnu-gcc",
    # omitted for brevity...
}

To reproduce an actual error that stems from this, build the following Docker image, which installs pygraphviz, which in turn needs to be built with gcc:

FROM amazonlinux:2023

RUN dnf install -y gcc g++ tar

RUN curl -LO https://astral.sh/uv/install.sh \
    && sh install.sh \
    && rm install.sh \
    && source $HOME/.local/bin/env \
    && uv venv --python 3.10 \
    && uv pip install pygraphviz==1.14

This ultimately fails with the following:

error: command '/usr/bin/aarch64-linux-gnu-gcc' failed: No such file or directory

Platform

Amazon Linux 2023 aarch64 (Linux 6.10.14-linuxkit aarch64 GNU/Linux)

Version

uv 0.6.14

Python version

3.10.17

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions