bulatko commited on
Commit
f2ed949
·
1 Parent(s): dcb1ea4

Runtime fallback: install local detectron2 if import fails (no build isolation)

Browse files
Files changed (1) hide show
  1. mvp.py +8 -8
mvp.py CHANGED
@@ -54,14 +54,14 @@ DETECTRON2_ROOT = os.path.join(REPO_ROOT, "MaskClustering", "third_party", "dete
54
  os.environ["PYTHONPATH"] = os.environ.get("PYTHONPATH", "") + ":" + os.path.join(REPO_ROOT, "MaskClustering", "third_party")
55
 
56
  # Ensure local detectron2 is installed at runtime if postBuild didn't run
57
- try:
58
- import detectron2 # noqa: F401
59
- except Exception:
60
- print("[runtime] detectron2 not found. Installing local detectron2 (editable, no build isolation)...")
61
- os.system("python -m pip install --no-build-isolation -e ./MaskClustering/third_party/detectron2")
62
- import importlib
63
- importlib.invalidate_caches()
64
- import detectron2 # noqa: F401
65
 
66
  # If detectron2 isn't installed as a package, allow importing from vendored source.
67
  if os.path.isdir(DETECTRON2_ROOT) and DETECTRON2_ROOT not in sys.path:
 
54
  os.environ["PYTHONPATH"] = os.environ.get("PYTHONPATH", "") + ":" + os.path.join(REPO_ROOT, "MaskClustering", "third_party")
55
 
56
  # Ensure local detectron2 is installed at runtime if postBuild didn't run
57
+ # try:
58
+ # import detectron2 # noqa: F401
59
+ # except Exception:
60
+ # print("[runtime] detectron2 not found. Installing local detectron2 (editable, no build isolation)...")
61
+ # os.system("python -m pip install --no-build-isolation -e ./MaskClustering/third_party/detectron2")
62
+ # import importlib
63
+ # importlib.invalidate_caches()
64
+ # import detectron2 # noqa: F401
65
 
66
  # If detectron2 isn't installed as a package, allow importing from vendored source.
67
  if os.path.isdir(DETECTRON2_ROOT) and DETECTRON2_ROOT not in sys.path: