nerfstudio
nerfstudio copied to clipboard
ImportError: cannot import name 'csrc' from 'gsplat'
Whenever I run ns-train with gaussian-splatting or igs2gs I get the following error (it works fine when using nerfacto):
{NOTE] Not running eval iterations since only viewer is enabled.
Use --vis {wandb, tensorboard, viewer+wandb, viewer+tensorboard} to run with eval.
No Nerfstudio checkpoint to load, so training from scratch.
Disabled comet/tensorboard/wandb event writers
C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:359: 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).
Printing profiling stats, from longest to shortest duration in seconds
VanillaPipeline.get_train_loss_dict: 0.6218
Trainer.train_iteration: 0.6218
Traceback (most recent call last):
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_backend.py", line 56, in
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\micro\anaconda3\envs\nerfstudio\Scripts\ns-train.exe_main.py", line 7, in
File "C:\Apps\nerfstudio\nerfstudio\scripts\train.py", line 262, in entrypoint
main(
File "C:\Apps\nerfstudio\nerfstudio\scripts\train.py", line 247, in main
launch(
File "C:\Apps\nerfstudio\nerfstudio\scripts\train.py", line 189, in launch
main_func(local_rank=0, world_size=world_size, config=config)
File "C:\Apps\nerfstudio\nerfstudio\scripts\train.py", line 100, in train_loop
trainer.train()
File "C:\Apps\nerfstudio\nerfstudio\engine\trainer.py", line 250, in train
loss, loss_dict, metrics_dict = self.train_iteration(step)
File "C:\Apps\nerfstudio\nerfstudio\utils\profiler.py", line 127, in inner
out = func(*args, **kwargs)
File "C:\Apps\nerfstudio\nerfstudio\engine\trainer.py", line 471, in train_iteration
_, loss_dict, metrics_dict = self.pipeline.get_train_loss_dict(step=step)
File "C:\Apps\nerfstudio\nerfstudio\utils\profiler.py", line 127, in inner
out = func(*args, **kwargs)
File "C:\Apps\nerfstudio\nerfstudio\pipelines\base_pipeline.py", line 304, in get_train_loss_dict
model_outputs = self._model(ray_bundle) # train distributed data parallel model if world_size > 1
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "C:\Apps\nerfstudio\nerfstudio\models\base_model.py", line 143, in forward
return self.get_outputs(ray_bundle)
File "C:\Apps\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 591, in get_outputs
self.xys, depths, self.radii, conics, num_tiles_hit, _ = ProjectGaussians.apply( # type: ignore
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\autograd\function.py", line 506, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\project_gaussians.py", line 67, in forward
) = C.project_gaussians_forward(
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_init.py", line 7, in call_cuda
from ._backend import _C
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_backend.py", line 79, in
_C = load(
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
return _jit_compile(
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1509, in _jit_compile
_write_ninja_file_and_build_library(
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1611, in _write_ninja_file_and_build_library
_write_ninja_file_to_build_library(
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 2048, in _write_ninja_file_to_build_library
_write_ninja_file(
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 2188, in _write_ninja_file
cl_paths = subprocess.check_output(['where',
File "C:\Users\micro\anaconda3\envs\nerfstudio\lib\subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\micro\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.
Steps to reproduce the behavior:
- After running COLMAP I run : ns-train gaussian-splatting --data output
- First few steps seem to work fine and then it crashes once it gets to: Trainer.train_iteration
- See error message above
Expected behavior I expect the COLMAP data to be trained using the gaussian-splatting or igs2gs model.
Additional context I followed the installation instructions exactly.
After nerfstudio dependencies I installed gsplat using: pip install git+https://github.com/nerfstudio-project/gsplat.git
After that I installed nerfstudio following instructions: git clone https://github.com/nerfstudio-project/nerfstudio.git cd nerfstudio pip install --upgrade pip setuptools pip install -e .
Visual Studio 2019 is installed including Desktop development with C+.
This was resolved by uninstalling gsplat and reinstalling it like so:
pip install git+https://github.com/nerfstudio-project/[email protected]
hi, what is the command to remove previous gsplat install. I have exactly the same issue
Worked for me.
pip uninstall gsplat
pip install git+https://github.com/nerfstudio-project/[email protected]
If the error persists, consider installing from
pip install git+https://github.com/nerfstudio-project/gsplat.git
as suggested in https://github.com/nerfstudio-project/nerfstudio/issues/2685#issuecomment-1859660671
If you're seeing this issue in PyTorch 2.0, there's also a good chance it's a PyTorch bug. Upgrading to 2.1 fixes it for some systems.
(https://github.com/nerfstudio-project/nerfstudio/pull/2748 has notes on why)
I have PyTorch 2.1.2+cu118 installed
and I've tried:
pip uninstall gsplat
pip install git+https://github.com/nerfstudio-project/[email protected].
and I get
...
Installing collected packages: gsplat
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
nerfstudio 1.0.0 requires gsplat==0.1.2.1, but you have gsplat 0.1.2 which is incompatible.
and also
pip uninstall gsplat
pip install git+https://github.com/nerfstudio-project/[email protected].
and always
Collecting git+https://github.com/nerfstudio-project/[email protected].
Cloning https://github.com/nerfstudio-project/gsplat.git (to revision v0.1.2.1.) to c:\users\carlo\appdata\local\temp\pip-req-build-7rgbikln
Running command git clone --filter=blob:none --quiet https://github.com/nerfstudio-project/gsplat.git 'C:\Users\carlo\AppData\Local\Temp\pip-req-build-7rgbikln'
WARNING: Did not find branch or tag 'v0.1.2.1.', assuming revision or ref.' 'Running command git checkout -q v0.1.2.1. error: pathspec 'v0.1.2.1.' did not match any file(s) known to git error: subprocess-exited-with-error
× git checkout -q v0.1.2.1. did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error
× git checkout -q v0.1.2.1. did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Do you have an extra period here?
pip install git+https://github.com/nerfstudio-project/[email protected].
=> pip install git+https://github.com/nerfstudio-project/[email protected]
may work.
Install apparently work with only a Yellow warning:
WARNING: Failed to remove contents in a temporary directory 'C:\Users\carlo\AppData\Local\Temp\pip-req-build-w_szq5df'.
You can safely remove it manually.
But it doesn't and I can't run ns-train
either as splatfacto
or gaussian-splatting
Here the splatfacto
error if could help
`Traceback (most recent call last):
File "C:\Users\carlo\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\carlo\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\carlo\anaconda3\envs\nerfstudio\Scripts\ns-train.exe_main.py", line 4, in
Are you on the latest version of nerfstudio?
That's my intention, I've completely rebuilt the anaconda environment installing:
git clone https://github.com/nerfstudio-project/nerfstudio.git
cd nerfstudio
pip install --upgrade pip setuptools
pip install -e .
Interesting, what's strange to me is this part of your error:
File "C:\Users\carlo\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 30, in
from gsplat.compute_cumulative_intersects import compute_cumulative_intersects
ModuleNotFoundError: No module named 'gsplat.compute_cumulative_intersects'
We no longer have a gaussian_splatting.py
in the repo, nor is the line that's producing this error present in the main branch when I search for it. Are you still getting this error despite a fresh clone of the repo?
I was rebuilding everything again but while installing it asked me to upgrade anaconda, I did it and I've lost ability to run Anaconda Navigator and installation went wrong. I'm uninstalling everything and start again from scratch. Thanks for help, I let you know.
I've reinstalled everything from Anaconda down to Nerfstudio following the guide but `ns-train splatfacto --data C:\Users\carlo\3DGSprojects\1750_CM --pipeline.model.cull-alpha-thresh 0.002 --max-num-iterations 100000 colmap --load_3D_points=True --downscale_factor 2' give me back the same error as before at first run, so I came back here and run
pip uninstall gsplat
pip install git+https://github.com/nerfstudio-project/[email protected]
and also
pip uninstall gsplat
pip install git+https://github.com/nerfstudio-project/gsplat.git
receiving the same error.
So I close the shell and run again the same command in a new one and now it's running! I'm around 15% now, it will take another 3h to complete. I'll post the results.
Now, please run
conda env export --no-builds > environment-nerfstudio.yml
so, in the next time, if (someday) your system breaks and you must reinstall python/conda, you can replicate the previous environment by running:
conda env create -f environment-nerfstudio.yml -n nerfstudio
Thanks @ichsan2895
Same issues as above and it solved for me - many thanks.
Yes that's crazy i also need to do it 2 times and now it's ok...
pip uninstall gsplat pip install git+https://github.com/nerfstudio-project/[email protected]
And now ok !!
This solved for me--and if it's helpful, I was able to resolve just by building from source w/o @version
pip install git+https://github.com/nerfstudio-project/gsplat.git
I had the same problem, just for those who are using Windows system to install Gsplat, please try
pip uninstall gsplat
and then refer to (sometimes need set DISTUTILS_USE_SDK=1
as well)
https://github.com/nerfstudio-project/gsplat/blob/main/docs/INSTALL_WIN.md