graphdeco-inria / gaussian-splatting

Original reference implementation of "3D Gaussian Splatting for Real-Time Radiance Field Rendering"
https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/
Other
14.1k stars 1.83k forks source link

python train.py -s ModuleNotFoundError: No module named 'diff_gaussian_rasterization' #140

Open manuvision opened 1 year ago

manuvision commented 1 year ago

I do see the diff_gaussian_rasterization folder in my submodules folder, but when trying to train my images, I get that error

(gaussian_splatting) C:\Users\username\gaussian-splatting>python train.py -s data/folder Traceback (most recent call last): File "train.py", line 16, in from gaussian_renderer import render, network_gui File "C:\Users\username\gaussian-splatting\gaussian_rendererinit.py", line 14, in from diff_gaussian_rasterization import GaussianRasterizationSettings, GaussianRasterizer ModuleNotFoundError: No module named 'diff_gaussian_rasterization'

Snosixtyboo commented 1 year ago

Just because the directory is there doesn't mean the module was installed. Try going into that directory and running python setup.py install

shayse-xr commented 1 year ago

This is what I got when I ran the python setup.py install command

(gaussian_splatting) C:\Users\User\gaussian-splatting\submodules\diff-gaussian-rasterization>python setup.py install No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8' running install D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !!

    ********************************************************************************
    Please avoid running ``setup.py`` directly.
    Instead, use pypa/build, pypa/installer or other
    standards-based tools.

    See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
    ********************************************************************************

!! self.initialize_options() D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated. !!

    ********************************************************************************
    Please avoid running ``setup.py`` and ``easy_install``.
    Instead, use pypa/build, pypa/installer or other
    standards-based tools.

    See https://github.com/pypa/setuptools/issues/917 for details.
    ********************************************************************************

!! self.initialize_options() running bdist_egg running egg_info writing diff_gaussian_rasterization.egg-info\PKG-INFO writing dependency_links to diff_gaussian_rasterization.egg-info\dependency_links.txt writing top-level names to diff_gaussian_rasterization.egg-info\top_level.txt reading manifest file 'diff_gaussian_rasterization.egg-info\SOURCES.txt' writing manifest file 'diff_gaussian_rasterization.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py running build_ext D:\Anaconda\envs\gaussian_splatting\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}') Traceback (most recent call last): File "C:\Users\User\gaussian-splatting\submodules\diff-gaussian-rasterization\setup.py", line 18, in setup( File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools__init.py", line 107, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\command\install.py", line 80, in run self.do_egg_install() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\command\install.py", line 129, in do_egg_install self.run_command('bdist_egg') File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\command\bdist_egg.py", line 164, in run cmd = self.call_command('install_lib', warn_dir=0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\command\bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\command\install_lib.py", line 11, in run self.build() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\command\install_lib.py", line 111, in build self.run_command('build_ext') File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\dist.py", line 1234, in run_command super().run_command(command) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run _build_ext.run(self) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run self.build_extensions() File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\torch\utils\cpp_extension.py", line 499, in build_extensions _check_cuda_version(compiler_name, compiler_version) File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\torch\utils\cpp_extension.py", line 383, in _check_cuda_version torch_cuda_version = packaging.version.parse(torch.version.cuda) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\pkg_resources_vendor\packaging\version.py", line 52, in parse return Version(version) ^^^^^^^^^^^^^^^^ File "D:\Anaconda\envs\gaussian_splatting\Lib\site-packages\pkg_resources_vendor\packaging\version.py", line 196, in init__ match = self._regex.search(version) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: expected string or bytes-like object, got 'NoneType'

w1xmovies commented 1 year ago

I have exactly the same error on "python setup.py install" and can't deal with it Any solutions?

Snosixtyboo commented 1 year ago

The error message suggests that the C++ compiler cannot be found. Is Visual Studio installed with C++ build support? If you are unsure, a detailed step-by-step guide for Windows is here. Let me know if it helps!

reconlabs-sergio commented 1 year ago

Just for the record, I had a similar problem while installing in an Ubuntu docker container. I ran python and imported torch. torch.cuda.is_available() returned False

My problem was solved once I updated the drivers on my host machine since they did not support CUDA 11.8 . NVIDIA drivers support CUDA up to a certain version. If they are not updated, it's likely that they don't support 11.8

shayse-xr commented 1 year ago

The C++ compiler is installed and the drivers are updated (v537.13). I tried to run again, but it still doesn't work

Snosixtyboo commented 1 year ago

Another user seems to have solved it by making sure that

Maybe this will help

Nitwel commented 1 year ago

Having the same problems, trying to follow the yt video exactly. Would love to see this resolved.

Collecting package metadata (repodata.json): done
Solving environment: done

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: \ "By downloading and using the CUDA Toolkit conda packages, you accept the terms and conditions of the CUDA End User License Agreement (EULA): https://docs.nvidia.com/cuda/eula/index.html"

done
Installing pip dependencies: - Ran pip subprocess with arguments:
['C:\\Users\\NilsPC\\anaconda3\\envs\\gaussian_splatting\\python.exe', '-m', 'pip', 'install', '-U', '-r', 'D:\\Programmieren\\gaussian-splatting\\condaenv.4zlr71j5.requirements.txt', '--exists-action=b']
Pip subprocess output:
Processing d:\programmieren\gaussian-splatting\submodules\diff-gaussian-rasterization
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Processing d:\programmieren\gaussian-splatting\submodules\simple-knn
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: diff-gaussian-rasterization, simple-knn
  Building wheel for diff-gaussian-rasterization (setup.py): started
  Building wheel for diff-gaussian-rasterization (setup.py): still running...
  Building wheel for diff-gaussian-rasterization (setup.py): finished with status 'done'
  Created wheel for diff-gaussian-rasterization: filename=diff_gaussian_rasterization-0.0.0-cp37-cp37m-win_amd64.whl size=319447 sha256=649081a1b0d5ab74eeb272398889faa914a0d1ecbb0df71bb30d747fae6814cd
  Stored in directory: c:\users\nilspc\appdata\local\pip\cache\wheels\94\4b\fc\afaafd8505f262a88247b12b7a5f0b9dfc4cc03763eab6cca9
  Building wheel for simple-knn (setup.py): started
  Building wheel for simple-knn (setup.py): still running...
  Building wheel for simple-knn (setup.py): finished with status 'done'
  Created wheel for simple-knn: filename=simple_knn-0.0.0-cp37-cp37m-win_amd64.whl size=354143 sha256=200ec1f94b83fe847a7d7bdcbb62b0d1fb14f5b9392aaa9e258908c1849f6f0f
  Stored in directory: c:\users\nilspc\appdata\local\pip\cache\wheels\28\63\17\628561bd52071db3bd8e4efdf9372fd5daff2fbc527c79a83f
Successfully built diff-gaussian-rasterization simple-knn
Installing collected packages: simple-knn, diff-gaussian-rasterization
Successfully installed diff-gaussian-rasterization-0.0.0 simple-knn-0.0.0

done
#
# To activate this environment, use
#
#     $ conda activate gaussian_splatting
#
# To deactivate an active environment, use
#
#     $ conda deactivate

/gaussian-splatting > conda activate gaussian_splatting
/gaussian-splatting > python train.py -s E:\photogrammetry\bedroom-2
Traceback (most recent call last):
  File "D:\Programmieren\gaussian-splatting\train.py", line 16, in <module>
    from gaussian_renderer import render, network_gui
  File "D:\Programmieren\gaussian-splatting\gaussian_renderer\__init__.py", line 14, in <module>
    from diff_gaussian_rasterization import GaussianRasterizationSettings, GaussianRasterizer
ModuleNotFoundError: No module named 'diff_gaussian_rasterization'
/gaussian-splatting > nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
ahgsql commented 1 year ago

I had same issue, solved it by:

deactivating gaussian_splatting enviroment, removing it completely then recreated with conda env create --file environment.yml Now submodules also installed automatically and i m training

farzamvat commented 1 year ago

I had the same issue, no need to install setup.py in submodules directly @Snosixtyboo, conda env create --file environment.yml would install and build submodules as well. I faced this ModuleNotFoundError like @Nitwel & @manuvision when tried to train and I figured out that I was not activating conda environment correctly. I'm on Win 10 and I solved it by deactivating gaussian_splatting environment, removing it completely by using remove --all command and recreated with conda env --file environment.yml. Then I tried activating the gaussian_splatting env but nothing happened. I tried conda init powershell and closed the prompt and started a new one and found (base) in prompt. Simply activated the guassian_splatting env and (base) changed to (gaussian_splatting) then I tried to train my images and it worked like a charm. Using conda info -e you can see conda environments and with an asterisk it indicates which env has already been activated.

DrMemoryFish commented 1 year ago

I had the same issue, no need to install setup.py in submodules directly @Snosixtyboo, conda env create --file environment.yml would install and build submodules as well. I faced this ModuleNotFoundError like @Nitwel & @manuvision when tried to train and I figured out that I was not activating conda environment correctly. I'm on Win 10 and I solved it by deactivating gaussian_splatting environment, removing it completely by using remove --all command and recreated with conda env --file environment.yml. Then I tried activating the gaussian_splatting env but nothing happened. I tried conda init powershell and closed the prompt and started a new one and found (base) in prompt. Simply activated the guassian_splatting env and (base) changed to (gaussian_splatting) then I tried to train my images and it worked like a charm. Using conda info -e you can see conda environments and with an asterisk it indicates which env has already been activated.

none of this helped me

stefanoscolapasta commented 11 months ago

I had the same issue, no need to install setup.py in submodules directly @Snosixtyboo, conda env create --file environment.yml would install and build submodules as well. I faced this ModuleNotFoundError like @Nitwel & @manuvision when tried to train and I figured out that I was not activating conda environment correctly. I'm on Win 10 and I solved it by deactivating gaussian_splatting environment, removing it completely by using remove --all command and recreated with conda env --file environment.yml. Then I tried activating the gaussian_splatting env but nothing happened. I tried conda init powershell and closed the prompt and started a new one and found (base) in prompt. Simply activated the guassian_splatting env and (base) changed to (gaussian_splatting) then I tried to train my images and it worked like a charm. Using conda info -e you can see conda environments and with an asterisk it indicates which env has already been activated.

none of this helped me

Found a solution?

farzamvat commented 11 months ago

I had the same issue, no need to install setup.py in submodules directly @Snosixtyboo, conda env create --file environment.yml would install and build submodules as well. I faced this ModuleNotFoundError like @Nitwel & @manuvision when tried to train and I figured out that I was not activating conda environment correctly. I'm on Win 10 and I solved it by deactivating gaussian_splatting environment, removing it completely by using remove --all command and recreated with conda env --file environment.yml. Then I tried activating the gaussian_splatting env but nothing happened. I tried conda init powershell and closed the prompt and started a new one and found (base) in prompt. Simply activated the guassian_splatting env and (base) changed to (gaussian_splatting) then I tried to train my images and it worked like a charm. Using conda info -e you can see conda environments and with an asterisk it indicates which env has already been activated.

none of this helped me

Found a solution?

I had to initiate powershell by conda init command to make it possible to activate conda environment later on/off. It solved by doing this.

luxiffa commented 10 months ago

我遇到了同样的问题,我通过一步一步的搭建环境解决的问题。不使用environment.yml文件安装。打开environment文件,按照版本一个一个的安装。pip install submodules/diff-gaussian-rasterization和 pip install submodules/simple-knn安装即可。