ERROR: Could not build wheels for xxx which is required to install pyproject.toml-based projects

		File "/home/wenniu/anaconda3/envs/nero/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1774, in _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "/home/wenniu/anaconda3/envs/nero/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 2116, in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension
      [end of output]

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

这个问题是由于cuda版本、nvcc版本、Pytorch版本不一致所导致的。
我的解决方法是:
conda create -n py31013torch1131cu117 python=3.10.13
其中,python版本是3.10.13
torch的版本是1.13.1cu117
CUDA版本是11.7(及以上,事实上是12.2)
nvcc版本是11.7
torch安装: conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia
nvcc安装:

wget https://developer.download.nvidia.com/compute/cuda/11.7.1/local_installers/cuda_11.7.1_515.65.01_linux.run                                                             
sudo sh cuda_11.7.1_515.65.01_linux.run

最后在.bashrc或者.zshrc里面加入nvcc11.7的路径

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-11.7/

Please make sure that
 -   PATH includes /usr/local/cuda-11.7/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-11.7/lib64, or, add /usr/local/cuda-11.7/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.7/bin
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 515.00 is required for CUDA 11.7 functionality to work.
To install the driver using this installer, run the following command, replacing  with the name of this run file:
    sudo .run --silent --driver

Logfile is /var/log/cuda-installer.log
PATH=/usr/local/cuda-11.7/bin:$PATH
LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH

你可能感兴趣的:(Linux,linux)