ashawkey / torch-ngp

A pytorch CUDA extension implementation of instant-ngp (sdf and nerf), with a GUI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

issues when build extensions:ERROR: Could not build wheels for raymarching, which is required to install pyproject.toml-based projects

xdobetter opened this issue · comments

my environment below:

Windows 10 with torch 1.11.0+cu113 & CUDA 11.3 on an RTX 3090 & tinycudann 1.7

I build torch-ngp according to "Install with pip", but I build extensions occurs errors.

pip install ./raymarching  # my  install commands

The errors bellow:

(ngp) J:\Research_Program\torch-ngp>pip install .\raymarching
Looking in indexes: https://mirror.sjtu.edu.cn/pypi/web/simple
Processing j:\research_program\torch-ngp\raymarching
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: raymarching
  Building wheel for raymarching (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [45 lines of output]
      running bdist_wheel
      running build
      running build_ext
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "J:\Research_Program\torch-ngp\raymarching\setup.py", line 44, in <module>
          setup(
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup
          return run_commands(dist)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
          dist.run_commands()
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\dist.py", line 1234, in run_command
          super().run_command(command)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\wheel\bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\dist.py", line 1234, in run_command
          super().run_command(command)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\dist.py", line 1234, in run_command
          super().run_command(command)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
          cmd_obj.run()
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\command\build_ext.py", line 84, in run
          _build_ext.run(self)
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
          self.build_extensions()
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\torch\utils\cpp_extension.py", line 396, in build_extensions
          self._check_abi()
        File "D:\ProgramData\Miniconda3\envs\ngp\lib\site-packages\torch\utils\cpp_extension.py", line 773, in _check_abi
          raise UserWarning(msg)
      UserWarning: It seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set `DISTUTILS_USE_SDK=1` and try again.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for raymarching
  Running setup.py clean for raymarching
Failed to build raymarching
ERROR: Could not build wheels for raymarching, which is required to install pyproject.toml-based projects

others extensions are the same problem.

I look some issue #167 , and I try torch1.12.1,but it still don't work.

Could anyone give me some pieces of advice?
Thanks!

Hello everyone,I have fixed the problem.
My environment bellow:
Windows10 with torch 1.12.0+cu113 & CUDA 11.3 on an RTX 3090 & tinycudann 1.7
I don't think the pytroch version is the cause of this issue as long as it matches the cuda version.I tried pytorch 1.11.0, 1.10.1, 1.12.1 , 1.12.0。

I fix the problem by change the folder freqencoder/gridencoder/raymarching/shencoder setup.py file

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++17', # set -std=c++17 
    '-U__CUDA_NO_HALF_OPERATORS__', '-U__CUDA_NO_HALF_CONVERSIONS__', '-U__CUDA_NO_HALF2_OPERATORS__',
]

I hope you find this information helpful.