diff --git a/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py b/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py index 442973036..ec82f0ad7 100644 --- a/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py +++ b/nerfstudio/process_data/colmap_converter_to_nerfstudio_dataset.py @@ -246,7 +246,7 @@ class ColmapConverterToNerfstudioDataset(BaseConverterToNerfstudioDataset): def __post_init__(self) -> None: super().__post_init__() install_checks.check_ffmpeg_installed() - install_checks.check_colmap_installed() + install_checks.check_colmap_installed(self.colmap_cmd) if self.crop_bottom < 0.0 or self.crop_bottom > 1: raise RuntimeError("crop_bottom must be set between 0 and 1.") diff --git a/nerfstudio/utils/install_checks.py b/nerfstudio/utils/install_checks.py index e9298cbb9..f9768ce24 100644 --- a/nerfstudio/utils/install_checks.py +++ b/nerfstudio/utils/install_checks.py @@ -15,6 +15,7 @@ """Helpers for checking if programs are installed""" import shutil +import subprocess import sys from nerfstudio.utils.rich_utils import CONSOLE @@ -29,10 +30,10 @@ def check_ffmpeg_installed(): sys.exit(1) -def check_colmap_installed(): +def check_colmap_installed(colmap_cmd: str): """Checks if colmap is installed.""" - colmap_path = shutil.which("colmap") - if colmap_path is None: + out = subprocess.run(f"{colmap_cmd} -h", capture_output=True, shell=True, check=False) + if out.returncode != 0: CONSOLE.print("[bold red]Could not find COLMAP. Please install COLMAP.") print("See https://colmap.github.io/install.html for installation instructions.") sys.exit(1)