Mamba安装失败的过程中,causal-conv1d安装报错为连接超时
Mamba安装
主要故障是 pip install causal-conv1d==1.2.0 安装失败
安装实践比较长,请耐心等待
解决方案
受到启发运行Mamba项目时无法直接用pip install安装causal_conv1d和mamba_ssm_pip install causal-conv1d编译文件-CSDN博客
本地安装causal-conv1d时,一定要检查机器的gcc和g++版本,本人默认是gcc5就会编译报错,gcc9就能安装成功
安装时间比较长,请耐心等待
conda create -n your_env_name python=3.10.13
conda activate your_env_name
conda install cudatoolkit==11.8 -c nvidia
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
conda install -c "nvidia/label/cuda-11.8.0" cuda-nvcc
conda install packaging
git clone https://github.com/Dao-AILab/causal-conv1d.git
cd causal-conv1d
git checkout v1.2.0 # current latest version tag
CAUSAL_CONV1D_FORCE_BUILD=TRUE pip install .
git clone https://github.com/state-spaces/mamba.git
cd ../mamba
git checkout v1.2.0 # current latest version tag
MAMBA_FORCE_BUILD=TRUE pip install .
Ubuntu下gcc多版本共存和版本切换_ykrgcc-CSDN博客这里详细讲述了gcc版本切换
成功预览
失败经历
经历一
:::info
- Ubuntu内部先安装cuda11.8和cudnn
- 然后安装pytorch
- 然后安装
pip install causal-conv1d==1.2.0
,然后就报错了。都没等到安装Manba
:::
经历二
然后通过观察
Mamba 环境安装踩坑问题汇总及解决方法_building wheel for causal-conv1d (setup.py) …-CSDN博客
调整为
:::info
- Ubuntu内部先安装cuda11.8和cudnn
- 然后安装pytorch
- conda install packaging
- 然后安装pip install causal-conv1d==1.2.0,然后就报错了。也是都没等到安装Manba
:::
任然报错
经历三
完全按照作者提到的
:::info
- conda create -n your_env_name python=3.10.13
- conda activate your_env_name
- conda install cudatoolkit==11.8 -c nvidia
- pip install torch2.1.1 torchvision0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
- conda install -c “nvidia/label/cuda-11.8.0” cuda-nvcc
- conda install packaging
- pip install causal-conv1d==1.2.0 # 此处报错
- pip install mamba-ssm
:::
前面已经安装好了很多的依赖,只不过还是报错了
说是链接超时,网络问题。看到了希望
经历4
conda create -n your_env_name python=3.10.13
conda activate your_env_name
conda install cudatoolkit==11.8 -c nvidia
pip install torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cu118
conda install -c "nvidia/label/cuda-11.8.0" cuda-nvcc
conda install packaging
git clone https://github.com/Dao-AILab/causal-conv1d.git
cd causal-conv1d
git checkout v1.2.0 # current latest version tag
CAUSAL_CONV1D_FORCE_BUILD=TRUE pip install .
pip install mamba-ssm # 此处报错
至此才有了文章顶部的解决方案
conda环境内部安装cuda
好处就是当前环境使用的cuda和机器内的cuda不冲突
conda install cudatoolkit==11.8 -c nvidia
conda install -c "nvidia/label/cuda-11.8.0" cuda-nvcc
参考:flash-attention踩坑:使用conda管理CUDA