nerfstudio-project / nerfstudio

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

Assertion error when exporting Gaussian Splat #2774

Open Mono-Momo opened 8 months ago

Mono-Momo commented 8 months ago

Hi Everyone,

I have run into the following error when trying to export a gaussian splat. Any help or hints would be appreciated.

-- Started threads Setting up evaluation dataset... Caching all 22 images. Loading latest checkpoint from load_dir ✅ Done loading checkpoint from outputs\poster\nerfacto\2024-01-16_175345\nerfstudio_models\step-000029999.ckpt Traceback (most recent call last): File "C:\Users\mpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\mpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\mpc\anaconda3\envs\nerfstudio\Scripts\ns-export.exe__main__.py", line 7, in File "C:\Users\mpcc\nerfstudio\nerfstudio\scripts\exporter.py", line 564, in entrypoint tyro.cli(Commands).main() File "C:\Users\mpc\nerfstudio\nerfstudio\scripts\exporter.py", line 491, in main assert isinstance(pipeline.model, GaussianSplattingModel) AssertionError

maturk commented 8 months ago

It says you are loading a nerfacto model config but trying to export a gaussian splat ply file. First train a gaussian-splatting model, and then try exporting the splat.

Mono-Momo commented 8 months ago

Thank you very much for answering my beginners question, maturk. This makes total sense.

After double checking all installation steps, It seems i still have trouble training a gaussian splat (training and viewing a nerfacto as well as exporting a point cloud works fine).

I am stuck.

Pasting my error message here (some of it is in german, those sections roughly translate to "file could not been found" or in the last line "the module could not be found"):

Thank you.


(viser) Connection opened (0, 1 total), 8 persistent messages [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\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:383: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden warnings.warn(f'Error checking compiler version for {compiler}: {error}') ( ● ) gsplat: Setting up CUDA (This may take a few minutes the first time)INFORMATION: Es konnten keine Dateien mit dem angegebenen Muster gefunden werden. Exception in thread Thread-3: Traceback (most recent call last): File "C:\Users\moritzpc\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\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\threading.py", line 932, in _bootstrap_inner self.run() File "C:\Users\moritzpc\nerfstudio\nerfstudio\viewer\render_state_machine.py", line 218, in run outputs = self._render_img(action.camera_state) File "C:\Users\moritzpc\nerfstudio\nerfstudio\viewer\render_state_machine.py", line 164, in _render_img outputs = self.viewer.get_model().get_outputs_for_camera(camera, obb_box=obb) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 800, in get_outputs_for_camera outs = self.get_outputs(camera.to(self.device)) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 659, in get_outputs self.xys, depths, self.radii, conics, num_tiles_hit, cov3d = ProjectGaussians.apply( File "C:\Users\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\project_gaussians.py", line 67, in forward ) = _C.project_gaussians_forward( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda__init__.py", line 7, in call_cuda from ._backend import _C File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_backend.py", line 79, in _C = load( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\moritzpc\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. Printing profiling stats, from longest to shortest duration in seconds Trainer.train_iteration: 0.0200 VanillaPipeline.get_train_loss_dict: 0.0170 Traceback (most recent call last): File "C:\Users\moritzpc\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\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\Scripts\ns-train.exe__main.py", line 7, in File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 262, in entrypoint main( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 247, in main launch( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 189, in launch main_func(local_rank=0, world_size=world_size, config=config) File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 100, in train_loop trainer.train() File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 252, in train loss, loss_dict, metrics_dict = self.train_iteration(step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 473, in trainiteration , loss_dict, metrics_dict = self.pipeline.get_train_loss_dict(step=step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\pipelines\base_pipeline.py", line 300, in get_train_loss_dict model_outputs = self._model(ray_bundle) # train distributed data parallel model if world_size > 1 File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\base_model.py", line 143, in forward return self.get_outputs(ray_bundle) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 659, in get_outputs self.xys, depths, self.radii, conics, num_tiles_hit, cov3d = ProjectGaussians.apply( File "C:\Users\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\project_gaussians.py", line 67, in forward ) = _C.project_gaussians_forward( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda\init__.py", line 7, in call_cuda from ._backend import _C File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\gsplat\cuda_backend.py", line 79, in _C = load( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1736, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 2136, in _import_module_from_library module = importlib.util.module_from_spec(spec) ImportError: DLL load failed while importing gsplat_cuda: Das angegebene Modul wurde nicht gefunden.

maturk commented 8 months ago

looks like gsplat failed to install properly. In your conda environment, try running pip install git+https://github.com/nerfstudio-project/gsplat.git and see if the error presists

Mono-Momo commented 8 months ago

Maturk, thank you so much for your help. I tried your suggestion, and it seems to move things forward, but nerfstudio is not satisfied with the version of gsplat. Now, i get the following (i checked the github site of gsplat, no version 0.1.0. is listed there):

(nerfstudio) C:\Users\moritzpc\nerfstudio>pip install git+https://github.com/nerfstudio-project/gsplat.git Collecting git+https://github.com/nerfstudio-project/gsplat.git Cloning https://github.com/nerfstudio-project/gsplat.git to c:\users\moritzpc\appdata\local\temp\pip-req-build-5dvw8g3v Running command git clone --filter=blob:none --quiet https://github.com/nerfstudio-project/gsplat.git 'C:\Users\moritzpc\AppData\Local\Temp\pip-req-build-5dvw8g3v' Resolved https://github.com/nerfstudio-project/gsplat.git to commit 0c305abd816c74245ecdbb66395c841be72407cf Running command git submodule update --init --recursive -q Preparing metadata (setup.py) ... done Requirement already satisfied: jaxtyping in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from gsplat==0.1.2) (0.2.19) Requirement already satisfied: rich>=12 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from gsplat==0.1.2) (13.7.0) Requirement already satisfied: torch in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from gsplat==0.1.2) (2.1.2+cu118) Requirement already satisfied: markdown-it-py>=2.2.0 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from rich>=12->gsplat==0.1.2) (3.0.0) Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from rich>=12->gsplat==0.1.2) (2.17.2) Requirement already satisfied: typing-extensions<5.0,>=4.0.0 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from rich>=12->gsplat==0.1.2) (4.9.0) Requirement already satisfied: numpy>=1.20.0 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from jaxtyping->gsplat==0.1.2) (1.24.4) Requirement already satisfied: typeguard>=2.13.3 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from jaxtyping->gsplat==0.1.2) (4.1.5) Requirement already satisfied: filelock in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from torch->gsplat==0.1.2) (3.13.1) Requirement already satisfied: sympy in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from torch->gsplat==0.1.2) (1.12) Requirement already satisfied: networkx in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from torch->gsplat==0.1.2) (3.1) Requirement already satisfied: jinja2 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from torch->gsplat==0.1.2) (3.1.3) Requirement already satisfied: fsspec in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from torch->gsplat==0.1.2) (2023.12.2) Requirement already satisfied: mdurl~=0.1 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from markdown-it-py>=2.2.0->rich>=12->gsplat==0.1.2) (0.1.2) Requirement already satisfied: importlib-metadata>=3.6 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from typeguard>=2.13.3->jaxtyping->gsplat==0.1.2) (7.0.1) Requirement already satisfied: MarkupSafe>=2.0 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from jinja2->torch->gsplat==0.1.2) (2.1.3) Requirement already satisfied: mpmath>=0.19 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from sympy->torch->gsplat==0.1.2) (1.3.0) Requirement already satisfied: zipp>=0.5 in c:\users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages (from importlib-metadata>=3.6->typeguard>=2.13.3->jaxtyping->gsplat==0.1.2) (3.17.0) Building wheels for collected packages: gsplat Building wheel for gsplat (setup.py) ... done Created wheel for gsplat: filename=gsplat-0.1.2-cp38-cp38-win_amd64.whl size=6135641 sha256=6ed5f09de72bcdf2485fe98105e140531d55dae00db17622dbfa5001321c257b Stored in directory: C:\Users\moritzpc\AppData\Local\Temp\pip-ephem-wheel-cache-h_ud1xqf\wheels\68\f3\34\3ccab759b004575a625af86b721f2a6c1c35552b5cb6676cea Successfully built gsplat Installing collected packages: gsplat Attempting uninstall: gsplat Found existing installation: gsplat 0.1.0 Uninstalling gsplat-0.1.0: Successfully uninstalled gsplat-0.1.0 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 0.3.4 requires gsplat==0.1.0, but you have gsplat 0.1.2 which is incompatible. Successfully installed gsplat-0.1.2

maturk commented 8 months ago

Right yea, that is an annoying issue. when you pip install nerfstudio it should install gsplat 0.1.0 which is correct. I am not entirely sure why you are getting this weird dll error

Mono-Momo commented 8 months ago

Thank you. I reinstalled the environment, nerfstudio etc. all went smooth, until running: pip install -e .

the error says that a permisson to the dll was denied:

-- ERROR: Could not install packages due to an OSError: [WinError 5] Zugriff verweigert: 'C:\Users\moritzpc\anaconda3\envs\nerfstudio\msvcp140.dll' Consider using the --user option or check the permissions.

--

I than ran pip install -e . --user which resulted in no errors.

if trying to train a splat, now i get a simiar problem as before (possibly about gsplat). i am close to giving up on this. any help would be highly appreciated.

Error message:

C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:383: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden warnings.warn(f'Error checking compiler version for {compiler}: {error}') ( ● ) gsplat: Setting up CUDA (This may take a few minutes the first time)INFORMATION: Es konnten keine Dateien mit dem angegebenen Muster gefunden werden. Printing profiling stats, from longest to shortest duration in seconds Trainer.train_iteration: 0.5851 VanillaPipeline.get_train_loss_dict: 0.5841 Traceback (most recent call last): File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda_backend.py", line 56, in from gsplat import csrc as _C ImportError: cannot import name 'csrc' from 'gsplat' (C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\Scripts\ns-train.exe__main.py", line 7, in File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 262, in entrypoint main( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 247, in main launch( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 189, in launch main_func(local_rank=0, world_size=world_size, config=config) File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 100, in train_loop trainer.train() File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 252, in train loss, loss_dict, metrics_dict = self.train_iteration(step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 473, in trainiteration , loss_dict, metrics_dict = self.pipeline.get_train_loss_dict(step=step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\pipelines\base_pipeline.py", line 300, in get_train_loss_dict model_outputs = self._model(ray_bundle) # train distributed data parallel model if world_size > 1 File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\base_model.py", line 143, in forward return self.get_outputs(ray_bundle) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 659, in get_outputs self.xys, depths, self.radii, conics, num_tiles_hit, cov3d = ProjectGaussians.apply( File "C:\Users\moritzpc\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\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\project_gaussians.py", line 67, in forward ) = _C.project_gaussians_forward( File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda\init__.py", line 7, in call_cuda from ._backend import _C File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda_backend.py", line 79, in _C = load( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\moritzpc\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 8 months ago

@Mono-Momo sorry I am not a Windows user so these error messages a pretty cyptic to me. But it looks like the errors are coming from Microsoft Visual C++ stuff not being correctly installed or findable in your system. This "Msvcp140.dll" error hints to that. Where you able to install tiny-cuda-nn normally in nerfstudio? Your system cannot also find "cl.exe" which is what the "where cl" command fails in the last line. Basically it is crashing because gsplat is unable to compile on your system which is needed for gaussian-splatting to work in nerfstudio.

machenmusik commented 8 months ago

You may need to try using the x64 Developer command prompt, from the shortcuts that Visual Studio installs, to ensure that the paths are set correctly for Visual Studio / C++ / etc.

(I tend to use a shortcut that starts with that and then activates the correct Miniconda environment.)

Mono-Momo commented 8 months ago

Thank you maturk and machenmusik.

I tried installing from the x64 Developer command prompt. that unfortunately results in many errors, and tiny-cuda-nn not installing correclty.

I noticed that i have visual studio 2019 on my machine. could this be a source of complication?

machenmusik commented 8 months ago

Sorry that didn't help, it can be tricky in Windows getting both Visual Studio and Python environments to be active in same command prompt. I had to call the conda activate batch file explicitly from within the developer command prompt, which I then captured in a shortcut for ease of use, in order to get the correct Python virtual environment in that scenario.

machenmusik commented 8 months ago

I noticed that i have visual studio 2019 on my machine. could this be a source of complication?

I have gotten VS2017, 2019 and 2022 to work, although you need to reinstall CUDA SDK (at least) after you install a new version so the files for that version get installed.

Also, IIRC, you need the right VS modules installed for compilation to succeed, but I don't remember the list OTOH, and am out of pocket so can't check. Not sure if this was fully specified in nerfstudio / gsplat / nerfacc / tinycudann docs, maybe worth a doc PR if not.

Tejasdavande07 commented 8 months ago

Thank you. I reinstalled the environment, nerfstudio etc. all went smooth, until running: pip install -e .

the error says that a permisson to the dll was denied:

-- ERROR: Could not install packages due to an OSError: [WinError 5] Zugriff verweigert: 'C:\Users\moritzpc\anaconda3\envs\nerfstudio\msvcp140.dll' Consider using the --user option or check the permissions.

--

I than ran pip install -e . --user which resulted in no errors.

if trying to train a splat, now i get a simiar problem as before (possibly about gsplat). i am close to giving up on this. any help would be highly appreciated.

Error message:

C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:383: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden warnings.warn(f'Error checking compiler version for {compiler}: {error}') ( ● ) gsplat: Setting up CUDA (This may take a few minutes the first time)INFORMATION: Es konnten keine Dateien mit dem angegebenen Muster gefunden werden. Printing profiling stats, from longest to shortest duration in seconds Trainer.train_iteration: 0.5851 VanillaPipeline.get_train_loss_dict: 0.5841 Traceback (most recent call last): File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda_backend.py", line 56, in from gsplat import csrc as _C ImportError: cannot import name 'csrc' from 'gsplat' (C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplatinit.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\Scripts\ns-train.exemain.py", line 7, in File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 262, in entrypoint main( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 247, in main launch( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 189, in launch main_func(local_rank=0, world_size=world_size, config=config) File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 100, in train_loop trainer.train() File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 252, in train loss, loss_dict, metrics_dict = self.train_iteration(step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 473, in trainiteration , loss_dict, metrics_dict = self.pipeline.get_train_loss_dict(step=step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\pipelines\base_pipeline.py", line 300, in get_train_loss_dict model_outputs = self._model(ray_bundle) # train distributed data parallel model if world_size > 1 File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\base_model.py", line 143, in forward return self.get_outputs(ray_bundle) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 659, in get_outputs self.xys, depths, self.radii, conics, num_tiles_hit, cov3d = ProjectGaussians.apply( File "C:\Users\moritzpc\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\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\project_gaussians.py", line 67, in forward ) = _C.project_gaussians_forward( File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cudainit.py", line 7, in call_cuda from ._backend import _C File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda_backend.py", line 79, in _C = load( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\moritzpc\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.

I also faced same problems anyonce please suggest solution for the same.

HungNgoCT commented 8 months ago

Thank you. I reinstalled the environment, nerfstudio etc. all went smooth, until running: pip install -e . the error says that a permisson to the dll was denied: -- ERROR: Could not install packages due to an OSError: [WinError 5] Zugriff verweigert: 'C:\Users\moritzpc\anaconda3\envs\nerfstudio\msvcp140.dll' Consider using the --user option or check the permissions.

I than ran pip install -e . --user which resulted in no errors. if trying to train a splat, now i get a simiar problem as before (possibly about gsplat). i am close to giving up on this. any help would be highly appreciated.

Error message:

C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py:383: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden warnings.warn(f'Error checking compiler version for {compiler}: {error}') ( ● ) gsplat: Setting up CUDA (This may take a few minutes the first time)INFORMATION: Es konnten keine Dateien mit dem angegebenen Muster gefunden werden. Printing profiling stats, from longest to shortest duration in seconds Trainer.train_iteration: 0.5851 VanillaPipeline.get_train_loss_dict: 0.5841 Traceback (most recent call last): File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda_backend.py", line 56, in from gsplat import csrc as _C ImportError: cannot import name 'csrc' from 'gsplat' (C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplatinit.py) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\Scripts\ns-train.exemain.py", line 7, in File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 262, in entrypoint main( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 247, in main launch( File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 189, in launch main_func(local_rank=0, world_size=world_size, config=config) File "C:\Users\moritzpc\nerfstudio\nerfstudio\scripts\train.py", line 100, in train_loop trainer.train() File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 252, in train loss, loss_dict, metrics_dict = self.train_iteration(step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\engine\trainer.py", line 473, in trainiteration , loss_dict, metrics_dict = self.pipeline.get_train_loss_dict(step=step) File "C:\Users\moritzpc\nerfstudio\nerfstudio\utils\profiler.py", line 112, in inner out = func(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\pipelines\base_pipeline.py", line 300, in get_train_loss_dict model_outputs = self._model(ray_bundle) # train distributed data parallel model if world_size > 1 File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1518, in _wrapped_call_impl return self._call_impl(args, kwargs) File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\nn\modules\module.py", line 1527, in _call_impl return forward_call(*args, *kwargs) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\base_model.py", line 143, in forward return self.get_outputs(ray_bundle) File "C:\Users\moritzpc\nerfstudio\nerfstudio\models\gaussian_splatting.py", line 659, in get_outputs self.xys, depths, self.radii, conics, num_tiles_hit, cov3d = ProjectGaussians.apply( File "C:\Users\moritzpc\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\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\project_gaussians.py", line 67, in forward ) = _C.project_gaussians_forward( File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cudainit.py", line 7, in call_cuda from ._backend import _C File "C:\Users\moritzpc\AppData\Roaming\Python\Python38\site-packages\gsplat\cuda_backend.py", line 79, in _C = load( File "C:\Users\moritzpc\anaconda3\envs\nerfstudio\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\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\moritzpc\anaconda3\envs\nerfstudio\lib\subprocess.py", line 415, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "C:\Users\moritzpc\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.

I also faced same problems anyonce please suggest solution for the same.

I am also facing this when training with GSplat: subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1. Please help

Konstantysz commented 4 months ago

I think this might be the source of the problem: Why doesn't the 'where' command display any output when running in PowerShell?. I found that when I type where cl in Windows Command Prompt, it works as intended.

C:\Users\<USER>>where cl
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\cl.exe

But when I type the same in Powershell, it does not work it is explained in stack overflow thread above.

PS C:\Users\<USER>> where cl
PS C:\Users\<USER>>

It gets more interesting when I try to run subprocess.check_output(['where', 'cl']).decode(*SUBPROCESS_DECODE_ARGS).split('\r\n')in Python from shell:

PS C:\Users\<USER>> python
Python 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> SUBPROCESS_DECODE_ARGS = ('oem',)
>>> cl_paths = subprocess.check_output(['where', 'cl']).decode(*SUBPROCESS_DECODE_ARGS).split('\r\n')
>>> print(cl_paths)
['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64\\cl.exe', '']

But when I do the same from the same version of Python from my venv, it does not work.

(venv) PS C:\Users\<USER>\Documents\Repositories\nerfstudio> python
Python 3.11.8 (tags/v3.11.8:db85d51, Feb  6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> SUBPROCESS_DECODE_ARGS = ('oem',)
>>> cl_paths = subprocess.check_output(['where', 'cl']).decode(*SUBPROCESS_DECODE_ARGS).split('\r\n')
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\<USER>\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\<USER>\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

So I think this might be related to venv. I have not found the solution yet. If I'll find, I'll share.

EDIT It worked after reopening VS Code. So in my case it was this and adding cl to Path environmental variable.

sumanttyagi commented 4 months ago

addition to this

looks like gsplat failed to install properly. In your conda environment, try running pip install git+https://github.com/nerfstudio-project/gsplat.git and see if the error presists

if i uninstall and reinstall the things , i am able to train model but not export the ply file


──────────────────────────────────────────────────────── Error ─────────────────────────────────────────────────────────
                                            No checkpoint directory found at
outputgaussian1\1\splatfacto\2024-05-23_014221\nerfstudio_models,
             Please make sure the checkpoint exists, they should be generated periodically during training