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 #79

Open fjd-tri opened 2 years ago

fjd-tri commented 2 years ago

I followed the instruction to set up the conda environment. pip install . also shows install success although there are some warnings in the middle if I turn verbal on as I paste below.

(plenoxel) fjd@ubuntu:~/svox2$ pip install -vvv .
Using pip 21.2.4 from /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/pip (python 3.8)
Non-user install because site-packages writeable
Created temporary directory: /tmp/pip-ephem-wheel-cache-a7emr_2a
Created temporary directory: /tmp/pip-req-tracker-te95wz2u
Initialized build tracking at /tmp/pip-req-tracker-te95wz2u
Created build tracker: /tmp/pip-req-tracker-te95wz2u
Entered build tracker: /tmp/pip-req-tracker-te95wz2u
Created temporary directory: /tmp/pip-install-46ca95tc
Processing /home/jiadingfang/svox2
  Created temporary directory: /tmp/pip-req-build-54573r1e
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
  Added file:///home/jiadingfang/svox2 to build tracker '/tmp/pip-req-tracker-te95wz2u'
    Running setup.py (path:/tmp/pip-req-build-54573r1e/setup.py) egg_info for package from file:///home/jiadingfang/svox2
    Created temporary directory: /tmp/pip-pip-egg-info-f35aik22
    Running command python setup.py egg_info
    running egg_info
    creating /tmp/pip-pip-egg-info-f35aik22/svox2.egg-info
    writing /tmp/pip-pip-egg-info-f35aik22/svox2.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-f35aik22/svox2.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-pip-egg-info-f35aik22/svox2.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-f35aik22/svox2.egg-info/SOURCES.txt'
    /tmp/pip-req-build-54573r1e/setup.py:25: UserWarning: The environment variable `CUB_HOME` was not found.Installation will fail if your system CUDA toolkit version is less than 11.NVIDIA CUB can be downloaded from `https://github.com/NVIDIA/cub/releases`. You can unpack it to a location of your choice and set the environment variable `CUB_HOME` to the folder containing the `CMakeListst.txt` file.
      warnings.warn(
    /tmp/pip-req-build-54573r1e/setup.py:52: UserWarning: Failed to build CUDA extension
      warnings.warn("Failed to build CUDA extension")
    /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
      warnings.warn(
    package init file 'svox2/csrc/__init__.py' not found (or not a regular file)
    reading manifest file '/tmp/pip-pip-egg-info-f35aik22/svox2.egg-info/SOURCES.txt'
    adding license file 'LICENSE'
    writing manifest file '/tmp/pip-pip-egg-info-f35aik22/svox2.egg-info/SOURCES.txt'
  Source in /tmp/pip-req-build-54573r1e has version 0.0.1.dev0+sphtexcub.lincolor.fast, which satisfies requirement svox2==0.0.1.dev0+sphtexcub.lincolor.fast from file:///home/jiadingfang/svox2
  Removed svox2==0.0.1.dev0+sphtexcub.lincolor.fast from file:///home/jiadingfang/svox2 from build tracker '/tmp/pip-req-tracker-te95wz2u'
Created temporary directory: /tmp/pip-unpack-e4yuvmcy
Building wheels for collected packages: svox2
  Created temporary directory: /tmp/pip-wheel-yc1v8yvk
  Building wheel for svox2 (setup.py) ...   Destination directory: /tmp/pip-wheel-yc1v8yvk
  Running command /home/jiadingfang/miniconda3/envs/plenoxel/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-54573r1e/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-54573r1e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) 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-yc1v8yvk
  /tmp/pip-req-build-54573r1e/setup.py:25: UserWarning: The environment variable `CUB_HOME` was not found.Installation will fail if your system CUDA toolkit version is less than 11.NVIDIA CUB can be downloaded from `https://github.com/NVIDIA/cub/releases`. You can unpack it to a location of your choice and set the environment variable `CUB_HOME` to the folder containing the `CMakeListst.txt` file.
    warnings.warn(
  /tmp/pip-req-build-54573r1e/setup.py:52: UserWarning: Failed to build CUDA extension
    warnings.warn("Failed to build CUDA extension")
  /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
    warnings.warn(
  running bdist_wheel
  /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/torch/utils/cpp_extension.py:411: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/svox2
  copying svox2/version.py -> build/lib/svox2
  copying svox2/svox2.py -> build/lib/svox2
  copying svox2/defs.py -> build/lib/svox2
  copying svox2/utils.py -> build/lib/svox2
  copying svox2/__init__.py -> build/lib/svox2
  package init file 'svox2/csrc/__init__.py' not found (or not a regular file)
  /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.linux-x86_64
  creating build/bdist.linux-x86_64/wheel
  creating build/bdist.linux-x86_64/wheel/svox2
  copying build/lib/svox2/version.py -> build/bdist.linux-x86_64/wheel/svox2
  copying build/lib/svox2/svox2.py -> build/bdist.linux-x86_64/wheel/svox2
  copying build/lib/svox2/defs.py -> build/bdist.linux-x86_64/wheel/svox2
  copying build/lib/svox2/utils.py -> build/bdist.linux-x86_64/wheel/svox2
  copying build/lib/svox2/__init__.py -> build/bdist.linux-x86_64/wheel/svox2
  running install_egg_info
  running egg_info
  creating svox2.egg-info
  writing svox2.egg-info/PKG-INFO
  writing dependency_links to svox2.egg-info/dependency_links.txt
  writing top-level names to svox2.egg-info/top_level.txt
  writing manifest file 'svox2.egg-info/SOURCES.txt'
  reading manifest file 'svox2.egg-info/SOURCES.txt'
  adding license file 'LICENSE'
  writing manifest file 'svox2.egg-info/SOURCES.txt'
  Copying svox2.egg-info to build/bdist.linux-x86_64/wheel/svox2-0.0.1.dev0+sphtexcub.lincolor.fast-py3.8.egg-info
  running install_scripts
  adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
  creating build/bdist.linux-x86_64/wheel/svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/WHEEL
  creating '/tmp/pip-wheel-yc1v8yvk/svox2-0.0.1.dev0+sphtexcub.lincolor.fast-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
  adding 'svox2/__init__.py'
  adding 'svox2/defs.py'
  adding 'svox2/svox2.py'
  adding 'svox2/utils.py'
  adding 'svox2/version.py'
  adding 'svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/LICENSE'
  adding 'svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/METADATA'
  adding 'svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/WHEEL'
  adding 'svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/top_level.txt'
  adding 'svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/RECORD'
  removing build/bdist.linux-x86_64/wheel
done
  Created wheel for svox2: filename=svox2-0.0.1.dev0+sphtexcub.lincolor.fast-py3-none-any.whl size=28862 sha256=39eab6650f65831b69aef3fcfe3797a03dbcdae45fbce0e5bb984d03f82f8bfb
  Stored in directory: /tmp/pip-ephem-wheel-cache-a7emr_2a/wheels/ca/fb/53/c67bbe70d48fe75eebc2aa677efb613b4bd9da6292e80d98a3
Successfully built svox2
Installing collected packages: svox2
  Attempting uninstall: svox2
    Found existing installation: svox2 0.0.1.dev0+sphtexcub.lincolor.fast
    Uninstalling svox2-0.0.1.dev0+sphtexcub.lincolor.fast:
      Created temporary directory: /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/~vox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info
      Removing file or directory /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/svox2-0.0.1.dev0+sphtexcub.lincolor.fast.dist-info/
      Created temporary directory: /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/~vox2
      Removing file or directory /home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/svox2/
      Successfully uninstalled svox2-0.0.1.dev0+sphtexcub.lincolor.fast

Successfully installed svox2-0.0.1.dev0+sphtexcub.lincolor.fast
Removed build tracker: '/tmp/pip-req-tracker-te95wz2u'

But when I try to run the training script, it says CUDA extension could not be loaded, and the current version has to have CUDA acceleration.

(plenoxel) fjd@ubuntu:~/svox2/opt$ CUDA_VISIBLE_DEVICES=0 python -u opt.py -t ckpt/syn-test/ ~/data/nerf_synthetic/ship/ -c configs/syn.json
/home/jiadingfang/miniconda3/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! " +
Detected NeRF (Blender) dataset
LOAD DATA /home/jiadingfang/data/nerf_synthetic/ship/train
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:00<00:00, 105.87it/s]
 Generating rays, scaling factor 1
/home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/torch/functional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  /opt/conda/conda-bld/pytorch_1656352465323/work/aten/src/ATen/native/TensorShape.cpp:2894.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Detected NeRF (Blender) dataset
LOAD DATA /home/jiadingfang/data/nerf_synthetic/ship/test
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:01<00:00, 112.40it/s]
Traceback (most recent call last):
  File "opt.py", line 285, in <module>
    grid = svox2.SparseGrid(reso=reso_list[reso_id],
  File "/home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/svox2/svox2.py", line 535, in __init__
    self.accelerate()
  File "/home/jiadingfang/miniconda3/envs/plenoxel/lib/python3.8/site-packages/svox2/svox2.py", line 1491, in accelerate
    assert (
AssertionError: CUDA extension is currently required for accelerate

I looked at current issues including https://github.com/sxyu/svox2/issues/70#issue-1190559189, https://github.com/sxyu/svox2/issues/53, https://github.com/sxyu/svox2/issues/15, https://github.com/sxyu/svox2/issues/73. But they are either not solved, or do not solve the problem.

My system has Nvidia Driver Version: 510.73.05 and CUDA toolkit 11.3.

I appreciate it if you can help with it as this seems to be a common issue.