Skip to content

[bug] Can't build Rust extensions via pyo3 if using a uv-managed Python interpreter #10598

@LukeMathWalker

Description

@LukeMathWalker

When building the extension, the following error occurs (omitting the prefixes of some paths):

dyld[90807]: Library not loaded: /install/lib/libpython3.13.dylib
  Referenced from: <A73153CF-70A5-379B-B9D3-526153D8322F> repro/target/debug/deps/setup-29f3c899bfb488ef
  Reason: tried: '/install/lib/libpython3.13.dylib' (no such file), 'repro/target/debug/deps/libpython3.13.dylib' (no such file), 'repro/target/debug/libpython3.13.dylib' (no such file), '.rustup/toolchains/stable-aarch64-
apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpython3.13.dylib' (no such file), '.rustup/toolchains/stable-aarch64-apple-darwin/lib/libpython3.13.dylib' (no such file), '/Users/luca/lib/libpyt
hon3.13.dylib' (no such file), '/usr/local/lib/libpython3.13.dylib' (no such file), '/usr/lib/libpython3.13.dylib' (no such file, not in dyld cache)
error: test failed, to rerun pass `--lib

This is on macOS, using the latest Rust toolchain and uv build. I uploaded a reproduction repository to help with the investigation.

I originally suspected this to be an issue with sysconfig, but it appears to be configured correctly:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguv pythonRelated to the uv python interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions