nerfstudio icon indicating copy to clipboard operation
nerfstudio copied to clipboard

Error when running zipnerf method in nerfstudio

Open sblat021 opened this issue 1 year ago • 11 comments

I'm trying to run zipnerf and I'm getting the error below when running: ns-train zipnerf nerfstudio-data --data {DATA_DIR}. DATA_DIR is the directory containing the processed data generated with ns-process-data.

I also tried to run : ns-train zipnerf --data {DATA_DIR} ns-train zipnerf colmap --data {DATA_DIR/colmap}

But I'm getting errors on all of those. It seems that ns-train zipnerf nerfstudio-data --data {DATA_DIR} should be the correct command when using nerfstudio data, but there's no documentation on this yet.

ERROR:root:Path not found: /configs/360.gin Traceback (most recent call last): File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\micro\anaconda3\envs\nerfstudio101\Scripts\ns-train.exe\__main__.py", line 7, in <module> File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\scripts\train.py", line 262, in entrypoint main( File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\scripts\train.py", line 247, in main launch( File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\scripts\train.py", line 189, in launch main_func(local_rank=0, world_size=world_size, config=config) File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\scripts\train.py", line 99, in train_loop trainer.setup() File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\engine\trainer.py", line 149, in setup self.pipeline = self.config.pipeline.setup( File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\configs\base_config.py", line 54, in setup return self._target(self, **kwargs) File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\zipnerf_ns\zipnerf_pipeline.py", line 63, in __init__ self._model = config.model.setup( File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\configs\base_config.py", line 54, in setup return self._target(self, **kwargs) File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\nerfstudio\models\base_model.py", line 85, in __init__ self.populate_modules() # populate the modules File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\zipnerf_ns\zipnerf_model.py", line 56, in populate_modules gin.parse_config_files_and_bindings(gin_files, None) File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\gin\config.py", line 2497, in parse_config_files_and_bindings includes_and_imports = parse_config_file(config_file, skip_unknown) File "C:\Users\micro\anaconda3\envs\nerfstudio101\lib\site-packages\gin\config.py", line 2457, in parse_config_file raise IOError(err_str.format(config_file, prefixes)) OSError: Unable to open file: /configs/360.gin. Searched config paths: [''].

Steps to reproduce the behavior:

  1. Install nerfstudio and all dependencies
  2. Install zipnerf method using : pip install git+https://github.com/SuLvXiangXin/zipnerf-pytorch
  3. Install torch-scatter using: pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.2+${CUDA}.html
  4. navigate to project directory
  5. run ns-train zipnerf nerfstudio-data --data {DATA_DIR} or ns-train zipnerf --data {DATA_DIR}

Expected behavior: Should start training zipnerf using processed data.

Note: It looks like it is looking for some 360.gin file, which doesn't exist in nerfstudio's processed data. Did anyone have any luck getting zipnerf to run with nerfstudio?

sblat021 avatar Feb 16 '24 19:02 sblat021

I actually know how to fix this! I had this exact issue. I ended up cloning the original pytorch-Zipnerf's repository and that 360config file was in there. I just dropped it into the main nerfstudio folder and it started working.

I also was running into an error where it was looking for the sparse set within COLMAP and I fixed that error by simply just copying the sparse folder from within the COLMAP folder from the dataset I was trying to train and that fixed that issue too

michaelrubloff avatar Feb 16 '24 22:02 michaelrubloff

When you say main nerfstudio folder, do you mean: \anaconda3\envs\nerfstudio\Lib\site-packages\nerfstudio ? I installed nerfstudio using pip.

sblat021 avatar Feb 16 '24 23:02 sblat021

No, it was just the nerfstudio folder where your training data is hosted. So for me it's just user/name/nerfstudio

michaelrubloff avatar Feb 16 '24 23:02 michaelrubloff

Seems bug.. I follow this way from zipnerf-pytorch's website, and it works out of box.

pip install nerfstudio==1.0.1

cd zipnerf-pytorch
git clone https://github.com/SuLvXiangXin/zipnerf-pytorch.git
pip install ./extensions/cuda
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.0.0+${CUDA}.html

pip install -e . 
ns-install-cli

Note: I use Nerfstudio v1.0.1 which have not yet merged between zipnerf-pytorch and nerfstudio

ichsan2895 avatar Feb 17 '24 16:02 ichsan2895

unfortunately that doesn't work for me either.. it's failing when i pip install ./extensions/cuda

`Processing c:\apps\zipnerf-pytorch\extensions\cuda Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [12 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Apps\zipnerf-pytorch\extensions\cuda\setup.py", line 35, in CUDAExtension( File "C:\Users\micro\anaconda3\envs\zipnerf\lib\site-packages\torch\utils\cpp_extension.py", line 1074, in CUDAExtension library_dirs += library_paths(cuda=True) File "C:\Users\micro\anaconda3\envs\zipnerf\lib\site-packages\torch\utils\cpp_extension.py", line 1208, in library_paths paths.append(_join_cuda_home(lib_dir)) File "C:\Users\micro\anaconda3\envs\zipnerf\lib\site-packages\torch\utils\cpp_extension.py", line 2407, in _join_cuda_home raise OSError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.`

sblat021 avatar Feb 18 '24 05:02 sblat021

Anyone gotten this to work recently? I've been having similar issues setting this up on both Windows and Linux. Even zipnerf-pytorch project is failing for me on the same step as mentioned above. Any ideas or insights would be appreciated.

yggdrasil-917 avatar Feb 20 '24 19:02 yggdrasil-917

Now with Nerfstudio v1.0.2 I have a different issue than mentioned - Run : ns-train zipnerf It asks if I want to install the package, Yes.

Errors out on several Windows machines with :

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\Users\renbr\anaconda3\envs\nerfstudio\Lib\site-packages\cv2\cv2.pyd' Consider using the --user option or check the permissions.

Error installing method.

Anyone know what to try next ? it's a fresh install (1hr old!) and happens across all my windows machines.

Renbry avatar Feb 22 '24 23:02 Renbry

unfortunately that doesn't work for me either.. it's failing when i pip install ./extensions/cuda

`Processing c:\apps\zipnerf-pytorch\extensions\cuda Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [12 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Apps\zipnerf-pytorch\extensions\cuda\setup.py", line 35, in CUDAExtension( File "C:\Users\micro\anaconda3\envs\zipnerf\lib\site-packages\torch\utils\cpp_extension.py", line 1074, in CUDAExtension library_dirs += library_paths(cuda=True) File "C:\Users\micro\anaconda3\envs\zipnerf\lib\site-packages\torch\utils\cpp_extension.py", line 1208, in library_paths paths.append(_join_cuda_home(lib_dir)) File "C:\Users\micro\anaconda3\envs\zipnerf\lib\site-packages\torch\utils\cpp_extension.py", line 2407, in _join_cuda_home raise OSError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.`

@sblat021 'CUDA_HOME environment variable is not set'. It seems that the CUDA environment variables are not set correctly. Does the following command return true when you execute it? import torch torch.cuda.is_available()

Jing1Ling avatar Feb 28 '24 02:02 Jing1Ling

there is another method just make colmap output( sparse data) using nerfstudio's processed data (transform.json) check out here https://github.com/NVlabs/instant-ngp/issues/1080

tosemfdk avatar Apr 29 '24 15:04 tosemfdk

is this issue resolved please share the solution

sumanttyagi avatar Jun 28 '24 10:06 sumanttyagi

is this issue resolved please share the solution

Have you try this way? It works with Linux. I never test on Windows

pip install nerfstudio==1.0.3
pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

git clone https://github.com/SuLvXiangXin/zipnerf-pytorch.git
cd zipnerf-pytorch
pip install ./extensions/cuda
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.0.0+${CUDA}.html

pip install -e . 
ns-install-cli

Then you will able to run this command

ns-train zipnerf nerfstudio-data --data path/to/your/data

ichsan2895 avatar Jun 29 '24 09:06 ichsan2895