ashawkey/RAD-NeRF

Errors while running: ! bash scripts/install_ext.sh

lsvagusa opened this issue · 1 comments

Hi, im trying to install everything needed to train my own model. I'm using a cloud GPU provided by Lambda Cloud, so the code is running in a Jupyter notebook. I succesfully manage to all the commands prior to ! bash scripts/install_ext.sh. But when running this I get the following errors:

/usr/lib/python3/dist-packages/torch/utils/cpp_extension.py:820: UserWarning: There are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 11.6
warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')

and

In file included from /usr/lib/python3/dist-packages/torch/include/torch/csrc/api/include/torch/python.h:12,
from /usr/lib/python3/dist-packages/torch/include/torch/extension.h:6,
from /home/ubuntu/RAD-NeRF/raymarching/src/bindings.cpp:1:
/usr/lib/python3/dist-packages/torch/include/torch/csrc/utils/pybind.h:7:10: fatal error: pybind11/pybind11.h: No such file or directory
7 | #include <pybind11/pybind11.h>
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Got it to work. The solution in my case was modifying the setup.py files for each of the following:
freqencoder, shencoder, gridencoder, raymarching.

The modification I made was adding the include_dirs parameter to the CUDAExtension function:

`import os
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

_src_path = os.path.dirname(os.path.abspath(file))

nvcc_flags = [
'-O3', '-std=c++14',
'-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__',
'-use_fast_math'
]

if os.name == "posix":
c_flags = ['-O3', '-std=c++14']
elif os.name == "nt":
c_flags = ['/O2', '/std:c++17']

# find cl.exe
def find_cl_path():
    import glob
    for edition in ["Enterprise", "Professional", "BuildTools", "Community"]:
        paths = sorted(glob.glob(r"C:\\Program Files (x86)\\Microsoft Visual Studio\\*\\%s\\VC\\Tools\\MSVC\\*\\bin\\Hostx64\\x64" % edition), reverse=True)
        if paths:
            return paths[0]

# If cl.exe is not on path, try to find it.
if os.system("where cl.exe >nul 2>nul") != 0:
    cl_path = find_cl_path()
    if cl_path is None:
        raise RuntimeError("Could not locate a supported Microsoft Visual C++ installation")
    os.environ["PATH"] += ";" + cl_path

setup(
name='freqencoder', # package name, import this to use python API
ext_modules=[
CUDAExtension(
name='_freqencoder', # extension name, import this to use CUDA API
sources=[os.path.join(_src_path, 'src', f) for f in [
'freqencoder.cu',
'bindings.cpp',
]],
include_dirs=['/home/ubuntu/.local/lib/python3.8/site-packages/pybind11/include'],
extra_compile_args={
'cxx': c_flags,
'nvcc': nvcc_flags,
}
),
],
cmdclass={
'build_ext': BuildExtension,
}
)
`