Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monarch_extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ monarch_tensor_worker = { version = "0.0.0", path = "../monarch_tensor_worker",
monarch_types = { version = "0.0.0", path = "../monarch_types" }
nccl-sys = { path = "../nccl-sys", optional = true }
ndslice = { version = "0.0.0", path = "../ndslice" }
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
rdmaxcel-sys = { path = "../rdmaxcel-sys", optional = true }
serde = { version = "1.0.219", features = ["derive", "rc"] }
tokio = { version = "1.47.1", features = ["full", "test-util", "tracing"] }
Expand Down
2 changes: 1 addition & 1 deletion monarch_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "BSD-3-Clause"
[dependencies]
derive_more = { version = "1.0.0", features = ["full"] }
hyperactor = { version = "0.0.0", path = "../hyperactor" }
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
serde = { version = "1.0.219", features = ["derive", "rc"] }
serde_bytes = "0.11"

Expand Down
24 changes: 3 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,10 @@ def run(self):
readme = f.read()

if sys.platform.startswith("linux"):
# Always include the active env's lib (Conda-safe)
# With extension-module, we don't link libpython, but we still need
# RPATH for finding libtorch and other PyTorch libraries
conda_lib = os.path.join(sys.prefix, "lib")

# Only use LIBDIR if it actually contains the current libpython
ldlib = sysconfig.get_config_var("LDLIBRARY") or ""
libdir = sysconfig.get_config_var("LIBDIR") or ""
py_lib = ""
if libdir and ldlib:
cand = os.path.join(libdir, ldlib)
if os.path.exists(cand) and os.path.realpath(libdir) != os.path.realpath(
conda_lib
):
py_lib = libdir

# Prefer sidecar .so next to the extension; then the conda env;
# then (optionally) py_lib
flags = [
"-C",
"link-arg=-Wl,--enable-new-dtags",
Expand All @@ -145,14 +133,8 @@ def run(self):
"-C",
"link-arg=-Wl,-rpath,$ORIGIN",
"-C",
"link-arg=-Wl,-rpath,$ORIGIN/..",
"-C",
"link-arg=-Wl,-rpath,$ORIGIN/../../..",
"-C",
"link-arg=-Wl,-rpath," + conda_lib,
"link-arg=-Wl,-rpath," + conda_lib, # For libtorch
]
if py_lib:
flags += ["-C", "link-arg=-Wl,-rpath," + py_lib]

cur = os.environ.get("RUSTFLAGS", "")
os.environ["RUSTFLAGS"] = (cur + " " + " ".join(flags)).strip()
Expand Down
2 changes: 1 addition & 1 deletion torch-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ hyperactor = { version = "0.0.0", path = "../hyperactor" }
monarch_types = { version = "0.0.0", path = "../monarch_types" }
nccl-sys = { path = "../nccl-sys", optional = true }
paste = "1.0.14"
pyo3 = { version = "0.24", features = ["anyhow", "multiple-pymethods", "py-clone"] }
pyo3 = { version = "0.24", features = ["anyhow", "extension-module", "multiple-pymethods", "py-clone"] }
regex = "1.11.1"
serde = { version = "1.0.219", features = ["derive", "rc"] }
thiserror = "2.0.12"
Expand Down
Loading