【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错

在服务器配置A Learned Sketch for Subgraph Counting的环境时报错:
pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错

一大长串报错,也没看懂什么意思,反正就是安装不下来我要的包

Building wheel for torch-scatter (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [55 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.7
      creating build/lib.linux-x86_64-3.7/torch_scatter
      copying torch_scatter/segment_coo.py -> build/lib.linux-x86_64-3.7/torch_scatter
      copying torch_scatter/__init__.py -> build/lib.linux-x86_64-3.7/torch_scatter
      copying torch_scatter/segment_csr.py -> build/lib.linux-x86_64-3.7/torch_scatter
      copying torch_scatter/utils.py -> build/lib.linux-x86_64-3.7/torch_scatter
      copying torch_scatter/scatter.py -> build/lib.linux-x86_64-3.7/torch_scatter
      copying torch_scatter/placeholder.py -> build/lib.linux-x86_64-3.7/torch_scatter
      creating build/lib.linux-x86_64-3.7/torch_scatter/composite
      copying torch_scatter/composite/logsumexp.py -> build/lib.linux-x86_64-3.7/torch_scatter/composite
      copying torch_scatter/composite/std.py -> build/lib.linux-x86_64-3.7/torch_scatter/composite
      copying torch_scatter/composite/__init__.py -> build/lib.linux-x86_64-3.7/torch_scatter/composite
      copying torch_scatter/composite/softmax.py -> build/lib.linux-x86_64-3.7/torch_scatter/composite
      running build_ext
      building 'torch_scatter._scatter' extension
      creating build/temp.linux-x86_64-3.7
      creating build/temp.linux-x86_64-3.7/tmp
      creating build/temp.linux-x86_64-3.7/tmp/pip-install-hcc9jdm1
      creating build/temp.linux-x86_64-3.7/tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739
      creating build/temp.linux-x86_64-3.7/tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739/csrc
      creating build/temp.linux-x86_64-3.7/tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739/csrc/cpu
      creating build/temp.linux-x86_64-3.7/tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739/csrc/cuda
      gcc -pthread -B /home/qiuwentao/anaconda3/envs/gpcard/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739/csrc -I/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages/torch/include -I/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages/torch/include/TH -I/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/qiuwentao/anaconda3/envs/gpcard/include/python3.7m -c /tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739/csrc/scatter.cpp -o build/temp.linux-x86_64-3.7/tmp/pip-install-hcc9jdm1/torch-scatter_98f1c4c68cae4f89b3bdaf9052cbf739/csrc/scatter.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -
D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -arch=sm_35 --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=_scatter -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
      nvcc fatal   : Value 'sm_35' is not defined for option 'gpu-architecture'
      error: command '/usr/local/cuda/bin/nvcc' failed with exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> torch-scatter

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
(gpcard) qiuwentao@kg-4090:~/projects/LSS-main-linux$ pip install torch_scatter-2.0.5-cp37-cp37m-linux_x86_64.whl
WARNING: Requirement 'torch_scatter-2.0.5-cp37-cp37m-linux_x86_64.whl' looks like a filename, but the file does not exist
Processing ./torch_scatter-2.0.5-cp37-cp37m-linux_x86_64.whl
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/qiuwentao/projects/LSS-main-linux/torch_scatter-2.0.5-cp37-cp37m-linux_x86_64.whl'

(gpcard) qiuwentao@kg-4090:~/projects/LSS-main-linux$ python active_train.py           --dataset aids            --embed_type prone        --mode cross_val   
Traceback (most recent call last):
  File "active_train.py", line 8, in 
    import cardnet
  File "/home/qiuwentao/projects/LSS-main-linux/cardnet/__init__.py", line 1, in 
    from .model import CardNet
  File "/home/qiuwentao/projects/LSS-main-linux/cardnet/model.py", line 6, in 
    from torch_scatter import scatter_mean
ModuleNotFoundError: No module named 'torch_scatter'
(gpcard) qiuwentao@kg-4090:~/projects/LSS-main-linux$ pip install "/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages"
ERROR: Directory '/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

文章要求的Requirements:

python 3.7
networkx
numpy
scipy
scikit-learn
torch >= 1.5.0
torch-geometric 1.6

尝试了各种方法仍然无法通过pip install安装,于是决定手动下载对应的轮子

根据文章Pytorch版本、CUDA版本与显卡驱动版本的对应关系

所需要的包和对应版本为【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错_第1张图片

【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错_第2张图片

去网站https://pytorch-geometric.com/whl/找到对应版本的并下载下来

【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错_第3张图片
【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错_第4张图片


上传服务器

【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错_第5张图片

直接输入对应路径进行pip install:pip install "/home/qiuwentao/anaconda3/envs/gpcard/lib/python3.7/site-packages/torch_sparse-0.6.8-cp37-cp37m-linux_x86_64.whl"

在这里插入图片描述

安装成功

在这里插入图片描述

在这里插入图片描述


服务器的配置为 4090显卡 CUDA版本 12.1

报错信息显示:具有CUDA功能的NVIDIA GeForce RTX 4090 sm_89与当前PyTorch安装不兼容。

NVIDIA GeForce RTX 4090 with CUDA capability sm_89 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37.
If you want to use the NVIDIA GeForce RTX 4090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

  warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))

【报错】Solved — pip install torch-scatter==2.0.5 及 pip install torch-sparse==0.6.8 报错_第6张图片

你可能感兴趣的:(笔记,pip,python,linux)