Skip to content

Failing to compile numpy from source against a uv-managed interpreter (Cannot compile Python.h.) #10558

@neutrinoceros

Description

@neutrinoceros

I'm not able to build numpy from source against a uv-managed Python:

../meson.build:44:2: ERROR: Problem encountered: Cannot compile `Python.h`. Perhaps you need to install python-dev|python-devel

this seems similar to #10185, which was transferred from https://github.com/astral-sh/python-build-standalone, so I'm opening this ticket directly in uv's repo. This issue was already present with uv 0.5.13 and appears to reproduce with 0.5.18

setup:

$ git clone https://github.com/numpy/numpy
$ cd numpy
$ git submodule update --init

then

$ uv build
Building source distribution...
+ /Users/clm/.cache/uv/builds-v0/.tmpcUq9Nd/bin/python /private/tmp/numpy/vendored-meson/meson/meson.py setup /private/tmp/numpy /private/tmp/numpy/.mesonpy-xqqxtm9n -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/private/tmp/numpy/.mesonpy-xqqxtm9n/meson-python-native-file.ini
The Meson build system
Version: 1.5.2
Source dir: /private/tmp/numpy
Build dir: /private/tmp/numpy/.mesonpy-xqqxtm9n
Build type: native build
Project name: NumPy
Project version: 2.3.0.dev0+git20241226.a07c6c5
C compiler for the host machine: cc (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C linker for the host machine: cc ld64 1115.7.3
C++ compiler for the host machine: c++ (clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.6)")
C++ linker for the host machine: c++ ld64 1115.7.3
Cython compiler for the host machine: cython (cython 3.0.11)
Host machine cpu family: aarch64
Host machine cpu: aarch64
Program python found: YES (/Users/clm/.cache/uv/builds-v0/.tmpcUq9Nd/bin/python)
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.3.0
Run-time dependency python found: YES 3.13
Has header "Python.h" with dependency python-3.13: NO

../meson.build:44:2: ERROR: Problem encountered: Cannot compile `Python.h`. Perhaps you need to install python-dev|python-devel

A full log can be found at /private/tmp/numpy/.mesonpy-xqqxtm9n/meson-logs/meson-log.txt
  × Failed to build `/private/tmp/numpy`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `mesonpy.build_sdist` failed (exit status: 1)
      hint: This usually indicates a problem with the package or the build environment.

A shorter path to the same error

$ uv venv
$ uv pip install git+https://github.com/numpy/numpy

Metadata

Metadata

Assignees

Labels

questionAsking for clarification or support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions