From a539e6fea7053ca864500cf5a9ec5f566c238b4c Mon Sep 17 00:00:00 2001 From: Shizhi Tang Date: Wed, 1 May 2024 20:00:43 +0800 Subject: [PATCH 1/2] Install detectron2 without build isolation --- torchbenchmark/util/framework/detectron2/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torchbenchmark/util/framework/detectron2/__init__.py b/torchbenchmark/util/framework/detectron2/__init__.py index 92c5c5d900..4006abbd30 100644 --- a/torchbenchmark/util/framework/detectron2/__init__.py +++ b/torchbenchmark/util/framework/detectron2/__init__.py @@ -43,7 +43,10 @@ def install_model_weights(model_name, model_dir): def pip_install_requirements(): requirements_file = os.path.join(CURRENT_DIR, "requirements.txt") subprocess.check_call( - [sys.executable, "-m", "pip", "install", "-q", "-r", requirements_file] + [sys.executable, "-m", "pip", "install", "-q", "wheel", "numpy", "cython"] # Build-time requirements + ) + subprocess.check_call( + [sys.executable, "-m", "pip", "install", "--no-build-isolation", "-q", "-r", requirements_file] ) From 5f6d0cf7cab4785261672501aac173cd07966798 Mon Sep 17 00:00:00 2001 From: Shizhi Tang Date: Thu, 2 May 2024 10:32:13 +0800 Subject: [PATCH 2/2] Remove numpy from explicit dependencies and add more comments --- torchbenchmark/util/framework/detectron2/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/torchbenchmark/util/framework/detectron2/__init__.py b/torchbenchmark/util/framework/detectron2/__init__.py index 4006abbd30..2a473e41fd 100644 --- a/torchbenchmark/util/framework/detectron2/__init__.py +++ b/torchbenchmark/util/framework/detectron2/__init__.py @@ -42,8 +42,10 @@ def install_model_weights(model_name, model_dir): def pip_install_requirements(): requirements_file = os.path.join(CURRENT_DIR, "requirements.txt") + # Installing by --no-build-isolation after explicitly installing build-time requirements is required. + # See https://github.com/facebookresearch/detectron2/issues/4921 subprocess.check_call( - [sys.executable, "-m", "pip", "install", "-q", "wheel", "numpy", "cython"] # Build-time requirements + [sys.executable, "-m", "pip", "install", "-q", "wheel", "cython"] # Build-time requirements ) subprocess.check_call( [sys.executable, "-m", "pip", "install", "--no-build-isolation", "-q", "-r", requirements_file]