You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
make monarch build compatible for both conda and uv
Summary:
## The Problem
Basically currently the monarch wheel cannot be installed by `uv`:
```
ImportError: libpython3.10.so.1.0: cannot open shared object file: No such file or directory
```
## Root Cause
The root cause is
- monarch wheel is built in Conda environment with rpaths baked into the compiled `.so` files
- `uv` installs Python in a different location (`~/.local/share/uv/python/...`), and therefore the baked-in paths don't exist in uv environments
## Proper Fix
There are workaround for `uv` installation, e.g. set `LD_LIBRARY_PATH` to point to `uv`'s Python library directory, but I think we should do a proper fix to the monarch build since ChatGPT said "Best practice is not to link extensions against libpython on Unix; the loader resolves Python symbols from the running interpreter. PyO3’s extension-module feature exists to avoid linking to libpython altogether. Manylinux guidance and PyO3 docs echo this." https://github.com/pypa/manylinux/issues/69?utm_source=chatgpt.com
This diff is an attempt to use ` extension-module` feature and roughly does two things
* Turn on the feature (in BUCK)
* Remove the hardcoded `rpath` from `setup.py`
-----
## Appendix
Workaround by setting `LD_LIBRARY_PATH`
1. Find your uv Python location:
```bash
uv run python -c "import sys; print(sys.executable)"
# Example output: /home/user/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/bin/python3.12
```
2. Set LD_LIBRARY_PATH:
```bash
# For Python 3.12 (adjust version as needed)
export LD_LIBRARY_PATH="$HOME/.local/share/uv/python/cpython-3.12.12-linux-x86_64-gnu/lib:$LD_LIBRARY_PATH"
```
Differential Revision: D86537232
0 commit comments