From 5a0905b32604757431df24ec290984d30c50441f Mon Sep 17 00:00:00 2001
From: Yen-Chen Lin <yenchenlin1994@gmail.com>
Date: Thu, 19 Jan 2023 09:25:27 -0500
Subject: [PATCH] Use subprocess to install detectron2

---
 scripts/colmap2nerf.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/colmap2nerf.py b/scripts/colmap2nerf.py
index ee1716b..ed1faf5 100755
--- a/scripts/colmap2nerf.py
+++ b/scripts/colmap2nerf.py
@@ -397,7 +397,9 @@ if __name__ == "__main__":
 			import detectron2
 		except ModuleNotFoundError:
 			input("Detectron2 is not installed. Press enter to install it.")
-			os.system("python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'")
+			import subprocess
+			package = 'git+https://github.com/facebookresearch/detectron2.git'
+			subprocess.check_call([sys.executable, "-m", "pip", "install", package])
 			import detectron2
 
 		import torch
-- 
GitLab