Skip to content

Commit

Permalink
fix py lmp plugin path for editable installation (#2922)
Browse files Browse the repository at this point in the history
When using `pip install -e`, the library and the source code are not in
the same directory, so `__file__` should not be used.

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Oct 15, 2023
1 parent a1c7a1b commit 4ead27b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions deepmd/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def dlopen_library(module: str, filename: str):
"global_cvt_2_tf_float",
"global_cvt_2_ener_float",
"MODEL_VERSION",
"SHARED_LIB_DIR",
"SHARED_LIB_MODULE",
"default_tf_session_config",
"reset_default_tf_session_config",
Expand Down
3 changes: 2 additions & 1 deletion deepmd/lmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
)

from deepmd.env import (
SHARED_LIB_DIR,
TF_VERSION,
tf,
)
Expand Down Expand Up @@ -74,7 +75,7 @@ def get_library_path(module: str, filename: str) -> List[str]:
raise RuntimeError("Unsupported platform")

tf_dir = tf.sysconfig.get_lib()
op_dir = str((Path(__file__).parent / "lib").absolute())
op_dir = str(SHARED_LIB_DIR)


cuda_library_paths = []
Expand Down

0 comments on commit 4ead27b

Please sign in to comment.