libpython not loaded under Anaconda
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 1k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 66
Description
Bug Description
While correctly detected, libpython*.dylib is not found at runtime under miniconda.
Steps to Reproduce
See the complete minimal code.
Backtrace
--- stdout
cargo:rerun-if-env-changed=PYO3_CROSS
cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION
cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG
-- PYO3_PRINT_CONFIG=1 is set, printing configuration and halting compile --
implementation=CPython
version=3.12
shared=true
abi3=false
lib_name=python3.12
lib_dir=/Users/runner/miniconda3/lib
executable=/Users/runner/miniconda3/bin/python
pointer_width=64
build_flags=
suppress_build_script_link_lines=false
note: unset the PYO3_PRINT_CONFIG environment variable and retry to compile with the above config
...
Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.78s
Running `target/debug/pyo3-test`
dyld[6132]: Library not loaded: @rpath/libpython3.12.dylib
Referenced from: <D47A24F9-530D-36D3-A2DF-66D920E7E1B9> /Users/runner/work/pyo3-test/pyo3-test/target/debug/pyo3-test
Reason: tried: '/Users/runner/work/pyo3-test/pyo3-test/target/debug/deps/libpython3.12.dylib' (no such file), '/Users/runner/work/pyo3-test/pyo3-test/target/debug/libpython3.12.dylib' (no such file), '/Users/runner/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpython3.12.dylib' (no such file), '/Users/runner/.rustup/toolchains/stable-aarch64-apple-darwin/lib/libpython3.12.dylib' (no such file), '/Users/runner/lib/libpython3.12.dylib' (no such file), '/usr/local/lib/libpython3.12.dylib' (no such file), '/usr/lib/libpython3.12.dylib' (no such file, not in dyld cache)
/Users/runner/work/_temp/23791571-1fd0-4d1a-b32c-b63b783c7030.sh: line 5: 6132 Abort trap: 6 cargo run
Error: Process completed with exit code 134.
Your operating system and version
MacOS (Github runner) — also on Linux
Your Python version (python --version)
Python 3.12
Your Rust version (rustc --version)
rustc 1.78.0 (9b00956e5 2024-04-29)
Your PyO3 version
0.21.2
How did you install python? Did you use a virtualenv?
Anaconda
Additional Info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked minimal pyo3-test reproduction and its cargo run output; inspect how PyO3 uses the reported lib_dir and how the macOS and Linux runtime loaders search for libpython*.dylib. Done means the Anaconda Python 3.12 library loads at runtime in the reproduction on the affected platforms without a manual workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- anaconda, macos, python, rust
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100