nerfstudio-project / nerfstudio

A collaboration friendly studio for NeRFs
https://docs.nerf.studio
Apache License 2.0
9.14k stars 1.22k forks source link

GSplat Error - subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1. #3003

Open JamesAscroft opened 5 months ago

JamesAscroft commented 5 months ago

Nerfstudio GSplat Error

Persistently getting this issue when attempting to train Splatfacto. Running latest Nerfstudio & Splatfacto.


ns-train splatfacto --data data/nerfstudio/Egypt


No Nerfstudio checkpoint to load, so training from scratch. Disabled comet/tensorboard/wandb event writers C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:383: UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified warnings.warn(f'Error checking compiler version for {compiler}: {error}') ( ● ) gsplat: Setting up CUDA (This may take a few minutes the first time)INFO: Could not find files for the given pattern(s). Exception in thread Thread-6: Traceback (most recent call last): File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_backend.py", line 56, in from gsplat import csrc as _C ImportError: cannot import name 'csrc' from 'gsplat' (C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\gsplat__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\James\anaconda3\envs\nerfstudio\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\nerfstudio\viewer\render_state_machine.py", line 222, in run outputs = self._render_img(action.camera_state) File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\nerfstudio\viewer\render_state_machine.py", line 168, in _render_img outputs = self.viewer.get_model().get_outputs_for_camera(camera, obb_box=obb) File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, *kwargs) File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\nerfstudio\models\splatfacto.py", line 914, in get_outputs_for_camera outs = self.get_outputs(camera.to(self.device)) File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\nerfstudio\models\splatfacto.py", line 739, in get_outputs self.xys, depths, self.radii, conics, comp, num_tiles_hit, cov3d = project_gaussians( # type: ignore File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\project_gaussians.py", line 61, in project_gaussians return _ProjectGaussians.apply( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\autograd\function.py", line 539, in apply return super().apply(args, *kwargs) # type: ignore[misc] File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\project_gaussians.py", line 112, in forward ) = _C.project_gaussians_forward( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda__init__.py", line 7, in call_cuda from ._backend import _C File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_backend.py", line 88, in _C = load( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile _write_ninja_file_and_build_library( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1810, in _write_ninja_file_and_build_library _write_ninja_file_to_build_library( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 2242, in _write_ninja_file_to_build_library _write_ninja_file( File "C:\Users\James\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 2382, in _write_ninja_file cl_paths = subprocess.check_output(['where', File "C:\Users\James\anaconda3\envs\nerfstudio\lib\subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\James\anaconda3\envs\nerfstudio\lib\subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

maturk commented 5 months ago

Problem with your windows machine c++ compiler tools. cl.exe not found basically. try some of the instructions in the docs for windows install image

JamesAscroft commented 5 months ago

Had to do a reinstall of the visual studio due to the classic 'vcvars64.bat'. Did not reinstall CUDA after. Could that be the issue?

JamesAscroft commented 5 months ago

I have no issues training using the nerfacto method?

maturk commented 5 months ago

It's just that the cuda backend for nerfacto, i.e. tinycudann, and the cuda backend of splatfacto, i.e. gsplat, are distinct and have their own install methods. gsplat info can be found here. Looks like it is just unable to find some cpp compiler linker, which the error says. I am not a windows user, but maybe googling something like "cl.exe not found, Windows" could guide you to better sources for debugging.

JamesAscroft commented 5 months ago

Thanks for helping! Will give it a go

tflsguoyu commented 4 months ago

Please try: pip uninstall gsplat pip install git+https://github.com/nerfstudio-project/gsplat.git And restart the terminal/shell/prompt