sxyu / svox2

Plenoxels: Radiance Fields without Neural Networks
BSD 2-Clause "Simplified" License
2.79k stars 360 forks source link

AssertionError: CUDA extension is currently required for accelerate #49

Open puallee opened 2 years ago

puallee commented 2 years ago

I still have the probelm of AssertionError: CUDA extension is currently required for accelerate ubuntu@ubuntu-broncus:/erick/rendering/svox2-master/svox2-master/opt$ python3.8 render_imgs.py /home/raid/erickData/data/TanksAndTempleBG/Train/ ../svox2/utils.py:39: UserWarning: CUDA extension svox2.csrc could not be loaded! Operations will be slow. Please do not import svox in the svox2 source directory. warn("CUDA extension svox2.csrc could not be loaded! " + Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off] Loading model from: /home/ubuntu/.local/lib/python3.8/site-packages/lpips/weights/v0.1/vgg.pth Defaulting to extended NSVF dataset LOAD NSVF DATA /home/raid/erickData/data/TanksAndTempleBG/Train/ split test 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 43/43 [00:00<00:00, 58.04it/s] NORMALIZE BY? camera scene_scale 2.0069090349061196 intrinsics (loaded reso) Intrin(fx=580.62451171875, fy=580.62451171875, cx=490.75, cy=273.0) Traceback (most recent call last): File "render_imgs.py", line 116, in grid = svox2.SparseGrid.load(args.ckpt, device=device) File "../svox2/svox2.py", line 1629, in load grid.accelerate() File "../svox2/svox2.py", line 1491, in accelerate assert ( AssertionError: CUDA extension is currently required for accelerate Can some help me ,my environment is python3.8 torch 1.8.0+cu111 nvidia driver 460.91.03 gpu 3090 ,torchaudio 0.8.0 torchvision 0.9.0+cu111 and gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu118.04)

parilo commented 2 years ago

I faced this issue, so basically pip install haven't compile CUDA extension without any warning. Te see what you need to compile do

cd svox2
cmake csrc
make -j 1

When you make sure it compiles just reinstall svox2 with pip, this time it should compile the extension.

pip uninstall svox2
pip install .
laulampaul commented 2 years ago

I faced this issue, so basically pip install haven't compile CUDA extension without any warning. Te see what you need to compile do

cd svox2
cmake csrc
make -j 1

When you make sure it compiles just reinstall svox2 with pip, this time it should compile the extension.

pip uninstall svox2
pip install .

I use your method, but it cannot work.

(plenoxel) root@fe4eb987aa96:.../svox2/opt# python
Python 3.8.8 (default, Apr 13 2021, 19:58:26)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import csrc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'csrc'
>>> import svox2.csrc
/opt/conda/envs/plenoxel/lib/python3.8/site-packages/svox2/utils.py:39: UserWarning: CUDA extension svox2.csrc could not be loaded! Operations will be slow.
Please do not import svox in the svox2 source directory.
  warn("CUDA extension svox2.csrc could not be loaded! " +
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /opt/conda/envs/plenoxel/lib/python3.8/site-packages/svox2/csrc.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor7is_cudaEv

how can I solve the question ?

LitterWindwind commented 2 years ago

When I use terminal to run, it's ok. But when I use pycharm to debug the code, I meet the same error. I have tried on three different machine, which is strange.

parilo commented 2 years ago

how can I solve the question ?

I didn't have this issue. It seems that either csrc.cpython-38-x86_64-linux-gnu.so wasn't linked with some library properly or this library doesn't load when you import csrc. Please read carefully messages during csrc compilation. When you do cmake and make. Maybe you spot something.

kamen007 commented 2 years ago

I meet the same problem~

laulampaul commented 2 years ago

I meet the same problem~

I solve the issue by using docker. I hope it can help you.

Utopiah commented 1 year ago

Hi @laulampaul, can you please share your Dockerfile?

muxizju commented 1 year ago

Reason: the compiled package name and the folder name in the project are both "svox2", they will be mis-imported when using in the opt.py script. Solution: aftering "pip install .", just simply remove the folder"./svox2/svox2". Then everything will work