zqh0253 / 3DitScene

3DitScene: Editing Any Scene via Language-guided Disentangled Gaussian Splatting
https://zqh0253.github.io/3DitScene/
179 stars 8 forks source link

Installing under Windows #1

Open SoftologyPro opened 5 months ago

SoftologyPro commented 5 months ago

Is this supposed to work under Windows? If so... Running these commands (I am assuming your pip install requirements needs to go after the clone)

git clone https://github.com/zqh0253/3DitScene.git --recursive
cd 3DitScene
pip install -r requirements.txt

Gives this error

Collecting git+https://github.com/KAIR-BAIR/nerfacc.git@v0.5.2 (from -r requirements.txt (line 5))
  Cloning https://github.com/KAIR-BAIR/nerfacc.git (to revision v0.5.2) to c:\users\jason\appdata\local\temp\pip-req-build-azl5g5gh
  Running command git clone --filter=blob:none --quiet https://github.com/KAIR-BAIR/nerfacc.git 'C:\Users\Jason\AppData\Local\Temp\pip-req-build-azl5g5gh'
  Running command git checkout -q d84cdf3afd7dcfc42150e0f0506db58a5ce62812
  Resolved https://github.com/KAIR-BAIR/nerfacc.git to commit d84cdf3afd7dcfc42150e0f0506db58a5ce62812
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  ¦ exit code: 1
  ?-> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Jason\AppData\Local\Temp\pip-req-build-azl5g5gh\setup.py", line 123, in <module>
          ext_modules=get_extensions() if not BUILD_NO_CUDA else [],
        File "C:\Users\Jason\AppData\Local\Temp\pip-req-build-azl5g5gh\setup.py", line 27, in get_extensions
          import torch
      ModuleNotFoundError: No module named 'torch'
      [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.

Problem is with

pip install git+https://github.com/KAIR-BAIR/nerfacc.git@v0.5.2

That gives the same error if run from command line.

Any way to get around this? Does torch need to be earlier in the requirements.txt? But if I try and run pip install torch before running pip install git+https://github.com/KAIR-BAIR/nerfacc.git@v0.5.2 then I get a new error. CUDA_HOME environment variable is not set. Please set it to your CUDA install root. Windows CUDA does not set a CUDA_HOME by default, it uses CUDA_PATH, but I set CUDA_HOME to match CUDA_PATH. Then trying pip install git+https://github.com/KAIR-BAIR/nerfacc.git@v0.5.2 gives the same CUDA_HOME not set.

D-Mad commented 5 months ago

You must install torch before installing requirements.txt follow this page to install nerfacc https://github.com/nerfstudio-project/nerfacc?tab=readme-ov-file

SoftologyPro commented 5 months ago

OK, thanks for that. Running pip install nerfacc -f https://nerfacc-bucket.s3.us-west-2.amazonaws.com/whl/torch-2.0.0_cu118.html and then removing nerfacc from requirements gets passed the problem when installing requirements.txt

It now gets as far as pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch from the requirements and fails with

Collecting git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch (from -r requirements.txt (line 5))
  Cloning https://github.com/NVlabs/tiny-cuda-nn/ to c:\users\jason\appdata\local\temp\pip-req-build-n2cu4g_a
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn/ 'C:\Users\Jason\AppData\Local\Temp\pip-req-build-n2cu4g_a'
  Resolved https://github.com/NVlabs/tiny-cuda-nn/ to commit 4892659e015b12bd2fce446b8a8e33e646b21746
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      <string>:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Traceback (most recent call last):
        File "D:\Tests\3DitScene\3DitScene\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\Tests\3DitScene\3DitScene\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "D:\Tests\3DitScene\3DitScene\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qqd7_wxr\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qqd7_wxr\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qqd7_wxr\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qqd7_wxr\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 9, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

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

pip list does show torch (2.3.0) is installed.

D-Mad commented 5 months ago

it has not yet found torch in your environment You must install torch correctly with cuda on your computer https://pytorch.org/get-started/previous-versions/ try : pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118

SoftologyPro commented 5 months ago

OK, I installed GPU torch before tiny-cuda-nn and get the same error. To make install testing easy, this is the sequence of commands to test a clean install every time and use a clean self contained environment....

echo *** Deleting 3DitScene directory if it exists
if exist 3DitScene\. rd /S /Q 3DitScene

echo *** Cloning 3DitScene repository
git clone https://github.com/zqh0253/3DitScene.git --recursive
cd 3DitScene

echo *** Creating venv
python -m venv venv
call venv\scripts\activate.bat

echo *** Upgrading pip
python -m pip install --upgrade pip

echo *** Patching requirements
findstr /V "nerfacc" requirements.txt > requirements_patched.txt
del requirements.txt
ren requirements_patched.txt requirements.txt

echo *** Installing nerfacc
pip install nerfacc -f https://nerfacc-bucket.s3.us-west-2.amazonaws.com/whl/torch-2.0.0_cu118.html

echo *** Installing GPU Torch
pip uninstall -y torch
pip uninstall -y torch
pip install torch==2.0.1+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

echo *** Installing requirements
pip install -r requirements.txt

Gives this error

*** Installing requirements
Collecting git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch (from -r requirements.txt (line 5))
  Cloning https://github.com/NVlabs/tiny-cuda-nn/ to c:\users\jason\appdata\local\temp\pip-req-build-u70xfu_c
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn/ 'C:\Users\Jason\AppData\Local\Temp\pip-req-build-u70xfu_c'
  Resolved https://github.com/NVlabs/tiny-cuda-nn/ to commit 4892659e015b12bd2fce446b8a8e33e646b21746
  Running command git submodule update --init --recursive -q
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      <string>:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Traceback (most recent call last):
        File "D:\Tests\3DitScene\3DitScene\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\Tests\3DitScene\3DitScene\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "D:\Tests\3DitScene\3DitScene\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qje6mh24\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qje6mh24\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qje6mh24\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\Jason\AppData\Local\Temp\pip-build-env-qje6mh24\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 9, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

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

× Getting requirements to build wheel 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.
zqh0253 commented 5 months ago

What is the version of Python used in your environment?

Also, can you verify if torch is installed correctly before installing tiny-cuda-nn:

python -c "import torch; print(torch.cuda.is_available());"

Currently, I do not have a Windows machine to test with. However, you might find specific suggestions for installation on Windows on the GitHub page for tiny-cuda-nn: https://github.com/NVlabs/tiny-cuda-nn.

SoftologyPro commented 5 months ago

Python 3.10.11 That code snippet returns true.

zqh0253 commented 5 months ago

FYI: https://github.com/NVlabs/tiny-cuda-nn/issues/214. Perhaps you could try the solutions in this issue.

SoftologyPro commented 5 months ago

The "fix" for using pip 23.0.1 makes no difference.. Same error. Maybe someone will work it out or they will get Windows supported. For now 3DitScene does not work under Windows.

SoftologyPro commented 5 months ago

Also if I temporarily skip the tiny-cuda-nn install step it also fails further on with missing torch for the pip install ./submodules/simple-knn step, so that another show stopper for Windows.

minipuft commented 5 months ago
➜ pip install ./submodules/langsplat-rasterization
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing c:\users\legoj\applications\3ditscene\submodules\langsplat-rasterization
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\legoj\Applications\3DitScene\myenv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\legoj\Applications\3DitScene\myenv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\legoj\Applications\3DitScene\myenv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-11a59yxx\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-11a59yxx\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-11a59yxx\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-11a59yxx\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

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

× Getting requirements to build wheel 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.
(myenv) ➜ 3DitScene ⚡( main)                                                                                                                         3.12.3 27 ho➜ pip install ./submodules/simple-knn
➜
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing c:\users\legoj\applications\3ditscene\submodules\simple-knn
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "C:\Users\legoj\Applications\3DitScene\myenv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\legoj\Applications\3DitScene\myenv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\legoj\Applications\3DitScene\myenv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-k1pmy20_\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-k1pmy20_\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-k1pmy20_\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "C:\Users\legoj\AppData\Local\Temp\pip-build-env-k1pmy20_\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]

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

× Getting requirements to build wheel 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.
(myenv) ➜ 3DitScene ⚡( main)                                                                                                                         3.12.3 27 ho➜ pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
Looking in indexes: https://download.pytorch.org/whl/cu121, https://pypi.ngc.nvidia.com
Requirement already satisfied: torch in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (2.3.0+cu121)
Requirement already satisfied: torchvision in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (0.18.0+cu121)
Requirement already satisfied: torchaudio in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (2.3.0+cu121)
Requirement already satisfied: filelock in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (4.9.0)
Requirement already satisfied: sympy in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (1.12)
Requirement already satisfied: networkx in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (3.2.1)
Requirement already satisfied: jinja2 in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (3.1.3)
Requirement already satisfied: fsspec in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (2024.2.0)
Requirement already satisfied: mkl<=2021.4.0,>=2021.1.1 in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torch) (2021.4.0)
Requirement already satisfied: numpy in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torchvision) (1.26.3)
Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from torchvision) (10.2.0)
Requirement already satisfied: intel-openmp==2021.* in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from mkl<=2021.4.0,>=2021.1.1->torch) (2021.4.0)
Requirement already satisfied: tbb==2021.* in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from mkl<=2021.4.0,>=2021.1.1->torch) (2021.11.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from jinja2->torch) (2.1.5)
Requirement already satisfied: mpmath>=0.19 in c:\users\legoj\applications\3ditscene\myenv\lib\site-packages (from sympy->torch) (1.3.0)

CUDA 12.1 Python 3.12

Yeah it looks like both simple-knn & langsplat-rasterazation are returning errors on windows...

Going to try with WSL

WPCJATH commented 4 months ago

One thing that may require notice is

even if you install the torch dependencies via: conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda==11.8 -c pytorch -c nvidia or pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118

When running pip install -r requirements.txt, pip will try to install the latest xformers which requires torch2.3.0, meaning it will force pip to upgrade torch to 2.3.0 and lead to a compatibility problem.

To solve this, assign the correct version of xformers in requirements.txt: xformers==0.0.20 (0.0.20 is exactly the version for torch2.0.1 refering to this) before pip install -r requirements.txt.

WPCJATH commented 4 months ago

It still cannot run on Windows though. WSL2 can do.

zqh0253 commented 4 months ago

Hi, sorry for the inconvenience caused. Unfortunately, I don't have access to a Windows machine for debugging at the moment.

However, since the pipeline works on WSL2, I believe Windows users can still use our work.