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

我在安装环境的时候,在安装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. 检查CUDA是否正确安装

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

检查CUDA安装路径

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

ls /usr/local/cuda

如果这个命令列出了目录内容,比如包括 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

添加这些行后,需要执行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 .
  • 15
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值