Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'diff_gaussian_rasterization' #26

Open
darkon12 opened this issue Dec 8, 2024 · 14 comments
Open

Comments

@darkon12
Copy link

darkon12 commented Dec 8, 2024

Got stuck at this error in google colab.
Last part of the log is:
Sampling: 100% 12/12 [00:08<00:00, 1.37it/s]
Sampling: 100% 12/12 [00:25<00:00, 2.10s/it]
Rendering: 0it [00:00, ?it/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1935, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1520, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2505, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1005, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 826, in wrapper
response = f(*args, **kwargs)
File "/content/TRELLIS/app.py", line 115, in image_to_3d
video = render_utils.render_video(outputs['gaussian'][0], num_frames=120)['color']
File "/content/TRELLIS/trellis/utils/render_utils.py", line 96, in render_video
return render_frames(sample, extrinsics, intrinsics, {'resolution': resolution, 'bg_color': bg_color}, **kwargs)
File "/content/TRELLIS/trellis/utils/render_utils.py", line 73, in render_frames
res = renderer.render(sample, extr, intr, colors_overwrite=colors_overwrite)
File "/content/TRELLIS/trellis/renderers/gaussian_render.py", line 223, in render
render_ret = render(camera_dict, gausssian, self.pipe, self.bg_color, override_color=colors_overwrite, scaling_modifier=self.pipe.scale_modifier)
File "/content/TRELLIS/trellis/renderers/gaussian_render.py", line 58, in render
from diff_gaussian_rasterization import GaussianRasterizer, GaussianRasterizationSettings
ModuleNotFoundError: No module named 'diff_gaussian_rasterization'

@YuDeng
Copy link
Contributor

YuDeng commented Dec 8, 2024

You can refer to #12

@HardikJain02
Copy link

run these commands:

find / -name 'diff-gaussian-rasterization' to find which folder has these two diff-gaussian-rasterization and simple-knn

cd tmp/extensions/mip-splatting/submodules (this is the location i had both of the submodules)

pip install diff-gaussian-rasterization simple-knn

@darkon12
Copy link
Author

darkon12 commented Dec 9, 2024

run these commands:

find / -name 'diff-gaussian-rasterization' to find which folder has these two diff-gaussian-rasterization and simple-knn

cd tmp/extensions/mip-splatting/submodules (this is the location i had both of the submodules)

pip install diff-gaussian-rasterization simple-knn

Already tried, I get:
ERROR: Could not find a version that satisfies the requirement diff-gaussian-rasterization (from versions: none)
ERROR: No matching distribution found for diff-gaussian-rasterization

@HardikJain02
Copy link

nvcc --version must show cuda 11.8

@alexdepario
Copy link

alexdepario commented Dec 9, 2024

Using on my home PC on Windows I got this: To create a public link, set share=True in launch().
Sampling: 100%|████████████████████████████████████████████████████████████████████████| 12/12 [00:02<00:00, 4.83it/s]
Sampling: 100%|████████████████████████████████████████████████████████████████████████| 12/12 [00:01<00:00, 6.93it/s]
Rendering: 0it [00:00, ?it/s]
Traceback (most recent call last):
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\blocks.py", line 1935, in process_api
result = await self.call_function(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\blocks.py", line 1520, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\anyio_backends_asyncio.py", line 2505, in run_sync_in_worker_thread
return await future
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\anyio_backends_asyncio.py", line 1005, in run
result = context.run(func, *args)
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\utils.py", line 826, in wrapper
response = f(*args, **kwargs)
File "F:\TRELLIS\TRELLIS\app.py", line 113, in image_to_3d
video = render_utils.render_video(outputs['gaussian'][0], num_frames=120)['color']
File "F:\TRELLIS\TRELLIS\trellis\utils\render_utils.py", line 96, in render_video
return render_frames(sample, extrinsics, intrinsics, {'resolution': resolution, 'bg_color': bg_color}, **kwargs)
File "F:\TRELLIS\TRELLIS\trellis\utils\render_utils.py", line 73, in render_frames
res = renderer.render(sample, extr, intr, colors_overwrite=colors_overwrite)
File "F:\TRELLIS\TRELLIS\trellis\renderers\gaussian_render.py", line 223, in render
render_ret = render(camera_dict, gausssian, self.pipe, self.bg_color, override_color=colors_overwrite, scaling_modifier=self.pipe.scale_modifier)
File "F:\TRELLIS\TRELLIS\trellis\renderers\gaussian_render.py", line 58, in render
from diff_gaussian_rasterization import GaussianRasterizer, GaussianRasterizationSettings
ModuleNotFoundError: No module named 'diff_gaussian_rasterization'

@HardikJain02
Copy link

HardikJain02 commented Dec 10, 2024

share your machine specs , do you have gpu, what torch and cuda toolkit versions you are using? you switched from colab to windows?

@darkon12
Copy link
Author

darkon12 commented Dec 10, 2024

No I didn't.
https://github.com/alexdepario
Another guy
;)
Anyway nvcc --version shows:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:02:13_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

That's the point, I tried to install 11.8 in colab but it did't work (it probably needs a reboot)
They say "The code has been tested with CUDA versions 11.8 and 12.2." but it's not exactly true.

@Andrey-rmnv
Copy link

Andrey-rmnv commented Dec 10, 2024

Same problem.
nvcc --version showed cuda 11.5, so I upgraded to 11.8, but it didn't help

UPD: rebooted the system, redo
. ./setup.sh --basic --xformers --diffoctreerast --spconv --mipgaussian --kaolin --nvdiffrast
problem solved

@HardikJain02
Copy link

@darkon12

If you have cuda 11.8 in the machine but nvcc doesn't point to it. [generally below is the location]

export PATH=/usr/local/cuda-11.8/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH

if you want to download cuda 11.8 first then repeat above command. and confirm using echo command. use gpt.

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /"
sudo apt-get update
sudo apt-get install -y cuda-11-8

@alexdepario
Copy link

alexdepario commented Dec 10, 2024

share your machine specs , do you have gpu, what torch and cuda toolkit versions you are using? you switched from colab to windows?

Windows 11 - running it for first time, haven't used colab
CUDA Toolkit 12.6, Driver 12.7
Devices:
"cpu" : "Intel64 Family 6 Model 151 Stepping 2, GenuineIntel"
"cuda:0" : "NVIDIA GeForce RTX 3090 Ti" (24 GiB, sm_86, mempool enabled)

I somehow got passed the error and now am able to run the app. When i click on Generate I get:

RuntimeError: CUDA out of memory. Tried to allocate 1273.14 GiB. GPU 0 has a total capacity of 23.99 GiB of which 0 bytes is free. Of the allocated memory 25.64 GiB is allocated by PyTorch, and 1.36 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)

I tryed before running again to "cmd set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True", but it was no help.

Here is thefull Traceback call: Traceback (most recent call last):
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\queueing.py", line 536, in process_events
response = await route_utils.call_process_api(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
output = await app.get_blocks().process_api(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\blocks.py", line 1935, in process_api
result = await self.call_function(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\blocks.py", line 1520, in call_function
prediction = await anyio.to_thread.run_sync( # type: ignore
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\anyio_backends_asyncio.py", line 2505, in run_sync_in_worker_thread
return await future
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\anyio_backends_asyncio.py", line 1005, in run
result = context.run(func, *args)
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\gradio\utils.py", line 826, in wrapper
response = f(*args, **kwargs)
File "F:\TRELLIS\TRELLIS\app.py", line 114, in image_to_3d
video = render_utils.render_video(outputs['gaussian'][0], num_frames=120)['color']
File "F:\TRELLIS\TRELLIS\trellis\utils\render_utils.py", line 96, in render_video
return render_frames(sample, extrinsics, intrinsics, {'resolution': resolution, 'bg_color': bg_color}, **kwargs)
File "F:\TRELLIS\TRELLIS\trellis\utils\render_utils.py", line 73, in render_frames
res = renderer.render(sample, extr, intr, colors_overwrite=colors_overwrite)
File "F:\TRELLIS\TRELLIS\trellis\renderers\gaussian_render.py", line 223, in render
render_ret = render(camera_dict, gausssian, self.pipe, self.bg_color, override_color=colors_overwrite, scaling_modifier=self.pipe.scale_modifier)
File "F:\TRELLIS\TRELLIS\trellis\renderers\gaussian_render.py", line 124, in render
rendered_image, radii = rasterizer(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\torch\nn\modules\module.py", line 1736, in wrapped_call_impl
return self.call_impl(*args, **kwargs)
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\torch\nn\modules\module.py", line 1747, in call_impl
return forward_call(*args, **kwargs)
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\diff_gaussian_rasterization_init
.py", line 216, in forward
return rasterize_gaussians(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\diff_gaussian_rasterization_init
.py", line 32, in rasterize_gaussians
return RasterizeGaussians.apply(
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\torch\autograd\function.py", line 575, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "F:\TRELLIS\TRELLIS\venv\lib\site-packages\diff_gaussian_rasterization_init
.py", line 94, in forward
num_rendered, color, radii, geomBuffer, binningBuffer, imgBuffer = C.rasterize_gaussians(*args)
RuntimeError: CUDA out of memory. Tried to allocate 1273.14 GiB. GPU 0 has a total capacity of 23.99 GiB of which 0 bytes is free. Of the allocated memory 25.64 GiB is allocated by PyTorch, and 1.36 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
Exception raised from malloc at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\c10\cuda\CUDACachingAllocator.cpp:1343 (most recent call first):
00007FFAC63883C900007FFAC6388320 c10.dll!c10::Error::Error [ @ ]
00007FFAC6335D3500007FFAC6335CC0 c10.dll!c10::OutOfMemoryError::OutOfMemoryError [ @ ]
00007FFB1663961400007FFB16637F40 c10_cuda.dll!c10::cuda::MemPool::id [ @ ]
00007FFB166396A000007FFB16637F40 c10_cuda.dll!c10::cuda::MemPool::id [ @ ]
00007FFB166323AA00007FFB1662FA10 c10_cuda.dll!c10::cuda::CUDAKernelLaunchRegistry::insert [ @ ]
00007FF9E69A822600007FF9E69A8110 torch_cuda.dll!at::native::resize_bytes_cuda [ @ ]
00007FF9E69A87E400007FF9E69A8310 torch_cuda.dll!at::native::resize_cuda
[ @ ]
00007FF9E69A851B00007FF9E69A8310 torch_cuda.dll!at::native::resize_cuda [ @ ]
00007FF9E86B13DF00007FF9E86842D0 torch_cuda.dll!at::cuda::where_outf [ @ ]
00007FF9E85D321000007FF9E855F530 torch_cuda.dll!at::cuda::bucketize_outf [ @ ]
00007FF9DC638D2500007FF9DC638C90 torch_cpu.dll!at::ops::resize::redispatch [ @ ]
00007FF9DED81F7900007FF9DED80070 torch_cpu.dll!torch::autograd::VariableType::allXPUTypes [ @ ]
00007FF9DED80E2600007FF9DED80070 torch_cpu.dll!torch::autograd::VariableType::allXPUTypes [ @ ]
00007FF9DC638D2500007FF9DC638C90 torch_cpu.dll!at::ops::resize::redispatch [ @ ]
00007FF9DED81E7D00007FF9DED80070 torch_cpu.dll!torch::autograd::VariableType::allXPUTypes [ @ ]
00007FF9DED80DF600007FF9DED80070 torch_cpu.dll!torch::autograd::VariableType::allXPUTypes [ @ ]
00007FF9DC5DBC3E00007FF9DC5DBAC0 torch_cpu.dll!at::ops::resize::call [ @ ]
00007FF9DB6AED8D00007FF9DB6AED60 torch_cpu.dll!at::Tensor::resize_ [ @ ]
00007FF9A106AAF800007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A106E8C000007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A106D54900007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A106976200007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A104F4CC00007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A106BA6C00007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A104A5BE00007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A1048F5D00007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A104900400007FF9A103FE50 _C.cp310-win_amd64.pyd!PyInit__C [ @ ]
00007FF9A103DB1E00007FF9A1035710 _C.cp310-win_amd64.pyd!c10::ivalue::Object::operator= [ @ ]
00007FFAEC4C9EEA00007FFAEC4C9E18 python310.dll!PyObject_IsTrue [ @ ]
00007FFAEC50BDCE00007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FFAEC50BECB00007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FFAEC52B5E700007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC5249D700007FFAEC524950 python310.dll!PyFunction_Vectorcall [ @ ]
00007FFAEC50BFB000007FFAEC50BF54 python310.dll!PyVectorcall_Call [ @ ]
00007FFAEC50BD9300007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FF9D4F8B13100007FF9D4F77380 torch_python.dll!THPPointer::THPPointer [ @ ]
00007FFAEC4C9F1900007FFAEC4C9E18 python310.dll!PyObject_IsTrue [ @ ]
00007FFAEC50BDCE00007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FFAEC50BECB00007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FFAEC52B5E700007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC52361500007FFAEC5225C0 python310.dll!PyObject_GC_Malloc [ @ ]
00007FFAEC52729300007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC5249D700007FFAEC524950 python310.dll!PyFunction_Vectorcall [ @ ]
00007FFAEC52603300007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC52361500007FFAEC5225C0 python310.dll!PyObject_GC_Malloc [ @ ]
00007FFAEC50C00C00007FFAEC50BF54 python310.dll!PyVectorcall_Call [ @ ]
00007FFAEC50BE8700007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FFAEC52B5E700007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC52361500007FFAEC5225C0 python310.dll!PyObject_GC_Malloc [ @ ]
00007FFAEC50C00C00007FFAEC50BF54 python310.dll!PyVectorcall_Call [ @ ]
00007FFAEC50BE8700007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]
00007FFAEC52B5E700007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC5249D700007FFAEC524950 python310.dll!PyFunction_Vectorcall [ @ ]
00007FFAEC4DA91700007FFAEC4DA844 python310.dll!PyObject_FastCallDictTstate [ @ ]
00007FFAEC5E81F400007FFAEC5E8178 python310.dll!PyObject_Call_Prepend [ @ ]
00007FFAEC5E815000007FFAEC5E7064 python310.dll!PyBytesWriter_Resize [ @ ]
00007FFAEC50FFBB00007FFAEC50FE58 python310.dll!PyObject_MakeTpCall [ @ ]
00007FFAEC52C39F00007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC5249D700007FFAEC524950 python310.dll!PyFunction_Vectorcall [ @ ]
00007FFAEC52BACD00007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC52862000007FFAEC5258A0 python310.dll!PyEval_EvalFrameDefault [ @ ]
00007FFAEC5249D700007FFAEC524950 python310.dll!PyFunction_Vectorcall [ @ ]
00007FFAEC50BFB000007FFAEC50BF54 python310.dll!PyVectorcall_Call [ @ ]
00007FFAEC50BE8700007FFAEC50BD44 python310.dll!PyObject_Call [ @ ]

@DiamondGlassDrill
Copy link

I receive the same error. Are you running other than 4090 gpu? @alexdepario

@fat-tire
Copy link

If you're using GCC 13, you may need to apply this patch. See here for more info.

Doing this allowed ./setup.sh --mipgaussian to complete in a Linux container with CUDA 12.6. The file in question, on my system anyway, was at /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/cuda_rasterizer/rasterizer_impl.h. It showed up after ./setup.sh --mipgaussian failed to build, but a subsequent attempt post-patch worked.

To install xformers, which also had a cuda-incompatibility issue I think, I just manually did pip3 install -U xformers --index-url https://download.pytorch.org/whl/cu124 Replace cu124 with your version of cuda. I'm using a rather new one, not 11.8 or whatever.

I think this is all I did to get the demo app working.

@m0eak
Copy link

m0eak commented Dec 25, 2024

Same problem. nvcc --version showed cuda 11.5, so I upgraded to 11.8, but it didn't help

UPD: rebooted the system, redo . ./setup.sh --basic --xformers --diffoctreerast --spconv --mipgaussian --kaolin --nvdiffrast problem solved

thanks

@NaUser
Copy link

NaUser commented Jan 11, 2025

https://github.com/autonomousvision/mip-splatting/tree/main I had the same problem before installing this package. Now everything works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants