facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.7k stars 1.3k forks source link

Bug solution of "You need C++17 to compile PyTorch" #1657

Closed kamata1729 closed 10 months ago

kamata1729 commented 11 months ago

With the latest pytorch, we need to compile pytorch3d from source. However, pip install "git+https://github.com/facebookresearch/pytorch3d.git" cannot be executed due to the following error:

error: #error You need C++17 to compile PyTorch
   27 | #error You need C++17 to compile PyTorch
      |  ^~~~~
error: command '/usr/local/cuda-11.8/bin/nvcc' failed with exit code 1
[end of output]

This bug can be solved with modifying the line of setup.py : https://github.com/facebookresearch/pytorch3d/blob/eaf0709d6af0025fe94d1ee7cec454bc3054826a/setup.py#L52 into

extra_compile_args = {"cxx": ["-std=c++17"]} 

and https://github.com/facebookresearch/pytorch3d/blob/eaf0709d6af0025fe94d1ee7cec454bc3054826a/setup.py#L77 into

nvcc_args.append("-std=c++17")
bottler commented 10 months ago

This has now happened.