sxyu / svox2

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

AssertionError: CUDA extension is currently required for accelerate #3

Closed vahidEtt closed 2 years ago

vahidEtt commented 2 years ago

After successfully building with CUDA extension, still getting the "CUDA extension" error. loss

pwais commented 2 years ago

what CUDA do you have and what arch are you trying to build for? builds for me within a pytorch/pytorch:1.8.1-cuda11.1-cudnn8-devel docker image (plus DEBIAN_FRONTEND=noninteractive apt-get install -y vim curl wget git less python3-pip libopencv-dev cmake build-essential ninja-build). I can run everything on a K80 though it's slow.

ghost commented 2 years ago

I built for Ubuntu 20.04 LTS with python==3.8, pytorch==1.10.0 and cuda11.3.

I will try to build it for pytorch 1.8.1 and cuda 11.1.

ghost commented 2 years ago

Same error for Ubuntu 20.04 LTS with python==3.8, pytorch==1.8.1 and cuda11.1.

pwais commented 2 years ago

what's the actual error you see? is your current working directory the repo root or the subdir opt (what's your PYTHONPATH ? have you tried pip instal -vvv . to see if there are any compiler errors?

vahidEtt commented 2 years ago

I do export PYTHONPATH=/path/to/env/python and now I can build it correctly. Thanks!

pengsongyou commented 2 years ago

I built for Ubuntu 20.04 LTS with python==3.8, pytorch==1.10.0 and cuda11.3.

I will try to build it for pytorch 1.8.1 and cuda 11.1.

I have the same setting as @vahidEtt, and when I ran with pip install -vvv . as suggested by @pwais, I got the following warning:

Building wheels for collected packages: svox2                                                                                                                                                                                                                                             
  Created temporary directory: /tmp/pip-wheel-4fsp6nn1
  Building wheel for svox2 (setup.py) ...   Destination directory: /tmp/pip-wheel-4fsp6nn1
  Running command /is/sg2/speng/anaconda3/envs/plenoxel/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-_rgs0hos/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-_rgs0hos/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__fi
le__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-4fsp6nn1
  /tmp/pip-req-build-_rgs0hos/setup.py:52: UserWarning: Failed to build CUDA extension                                                                                                                                                                                                        warnings.warn("Failed to build CUDA extension")

When I try to run the code, it is still having the AssertionError: CUDA extension is currently required for accelerate. I also tried what @vahidEtt suggested, but still no success. @sxyu Just wondering if you might have an idea on why?

Best, Songyou

pwais commented 2 years ago

@pengsongyou what's your current working directory when you run pip install? have you tried inside a clean docker container (as noted in https://github.com/sxyu/svox2/issues/3#issuecomment-991291594 ) ?

pengsongyou commented 2 years ago

@pengsongyou what's your current working directory when you run pip install? have you tried inside a clean docker container (as noted in #3 (comment) ) ?

Hi @pwais , unfortunately I don't think that I am able to use docker on our server, but if a clean container is required, I can try to find ways around. Nevertheless, it would still be nice if we can still install directly with conda :)

pwais commented 2 years ago

I have not tried the conda install because conda typically does not offer enough isolation for system dependencies and reproducibility. The error message suggests your cuda toolchain is not compatible with the code here-- the docker environment I cited appears compatible and will provide reproducibility. Try asking your sysadmin for docker / nvidia-docker as that will provide you with a lot better isolation-- keeping you and your sysadmin happy :)

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)