当前位置:   article > 正文

安装selective-scan的时候出现ERROR: Could not build wheels for selective-scan, which is required to install

error: could not build wheels for selective-scan, which is required to insta

我在安装环境的时候,在安装selective-scan的时候出现以下报错

Processing /data2/RSCD/VMamba-main/kernels/selective_scan
  Preparing metadata (setup.py) ... done
Requirement already satisfied: torch in /home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages (from selective-scan==0.0.2) (1.13.0)
Requirement already satisfied: packaging in /home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages (from selective-scan==0.0.2) (24.0)
Collecting ninja (from selective-scan==0.0.2)
  Downloading ninja-1.11.1.1-py2.py3-none-manylinux1_x86_64.manylinux_2_5_x86_64.whl.metadata (5.3 kB)
Collecting einops (from selective-scan==0.0.2)
  Using cached einops-0.7.0-py3-none-any.whl.metadata (13 kB)
Requirement already satisfied: typing_extensions in /home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages (from torch->selective-scan==0.0.2) (4.9.0)
Using cached einops-0.7.0-py3-none-any.whl (44 kB)
Downloading ninja-1.11.1.1-py2.py3-none-manylinux1_x86_64.manylinux_2_5_x86_64.whl (307 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 307.2/307.2 kB 425.6 kB/s eta 0:00:00
Building wheels for collected packages: selective-scan
  Building wheel for selective-scan (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]


      torch.__version__  = 1.13.0




      CUDA_HOME = /home/aipub/anaconda3/envs/rsmamba


      running bdist_wheel
      /home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages/torch/utils/cpp_extension.py:476: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      running build
      running build_ext
      building 'selective_scan_cuda_core' extension
      creating build
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/csrc
      creating build/temp.linux-x86_64-cpython-38/csrc/selective_scan
      creating build/temp.linux-x86_64-cpython-38/csrc/selective_scan/cus
      gcc -pthread -B /home/aipub/anaconda3/envs/rsmamba/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/data2/RSCD/VMamba-main/kernels/selective_scan/csrc/selective_scan -I/home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages/torch/include -I/home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages/torch/include/TH -I/home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages/torch/include/THC -I/home/aipub/anaconda3/envs/rsmamba/include -I/home/aipub/anaconda3/envs/rsmamba/include/python3.8 -c csrc/selective_scan/cus/selective_scan.cpp -o build/temp.linux-x86_64-cpython-38/csrc/selective_scan/cus/selective_scan.o -O3 -std=c++17 -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=selective_scan_cuda_core -D_GLIBCXX_USE_CXX11_ABI=0
      cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
      In file included from csrc/selective_scan/cus/selective_scan.cpp:5:
      /home/aipub/anaconda3/envs/rsmamba/lib/python3.8/site-packages/torch/include/ATen/cuda/CUDAContext.h:10:10: fatal error: cusolverDn.h: 没有那个文件或目录
         10 | #include <cusolverDn.h>
            |          ^~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for selective-scan
  Running setup.py clean for selective-scan
Failed to build selective-scan
ERROR: Could not build wheels for selective-scan, which is required to install pyproject.toml-based projects
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55

1. 检查CUDA是否正确安装

执行echo $CUDA_HOME,观察是否打印出CUDA信息,如果没有请按以下步骤来,如果有CUDA信息请忽略。

检查CUDA安装路径

一般CUDA默认安装在/usr/local/cuda目录下,执行以下命令检查CUDA是否正确安装:

ls /usr/local/cuda
  • 1

如果这个命令列出了目录内容,比如包括 binlib64 等子目录,那么说明 CUDA 已经安装了。

配置CUDA环境变量

把下面内容添加到~/.bashrc~/.bash_profile 文件中,假设CUDA安装在/usr/local/cuda-11.6

export CUDA_HOME=/usr/local/cuda-11.6
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64
  • 1
  • 2
  • 3

添加这些行后,需要执行source ~/.bashrcsource ~/.bash_profile 来使更改生效。
再次执行echo $CUDA_HOME,观察是否打印出CUDA信息。

2. 创建新的conda环境

完成上述步骤后,再次安装selective-scan还是会报错,主要是因为pytorch版本的原因,我重新安装了torch 1.12,再安装时成功了。

conda create -n rsmamba python=3.9
conda activate rsmamba
conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch
# 进入Vmamba目录,安装相关依赖
pip install -r requirements.txt
cd kernels/selective_scan && pip install .
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/626146
推荐阅读
相关标签
  

闽ICP备14008679号