背景:linux服务器上在docker容器内复现mamba,容器内环境是

pip 23.3.2

Python 3.8.0

CUDA Version 11.8.0

torch 2.0.0+cu118


使用pip install causal-conv1d 报错

报错:ERROR: Could not build wheels for causal-conv1d, which is required to install pyproject.toml-based projects

root@26fe4c104b24:/home/work/mamba-main# pip install causal-conv1d
  ##此处略过其他顺利的进程
    error: subprocess-exited-with-error
  
      × python setup.py bdist_wheel did not run successfully.
      │ exit code: 1
      ╰─> [8 lines of output]
      
      
          torch.__version__  = 2.0.0+cu118
      
      
          running bdist_wheel
          Guessing wheel URL:  https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.1.3.post1/causal_conv1d-1.1.3.post1+cu118torch2.0cxx11abiFALSE-cp38-cp38-linux_x86_64.whl
          error: <urlopen error [Errno 110] Connection timed out>
          [end of output]
  
      note: This error originates from a subprocess, and is likely not a problem with pip.
      ERROR: Failed building wheel for causal-conv1d
Failed to build causal-conv1d
ERROR: Could not build wheels for causal-conv1d, which is required to install pyproject.toml-based projects

显示wheel没下载成功,url打开超时了,简而言之,就是网络问题,可等网络好一些在尝试或者尝试以下方法。

解决方法1:如果开了VPN代理,建议关掉代理试试。

解决方法2:如果没有代理还是一样的显示超时,建议使用镜像源,在pip后加上-i <镜像源网址>

root@202711992fa9:~# pip install causal-conv1d  -i https://mirrors.aliyun.com/pypi/simple/

mamba目前对causal-conv1d的版本要求是causal-conv1d>=1.1.0,<1.2.0。我没指定版本下载的就是最新的1.1.3也符合要求,也可以指定版本,我的软件库有点旧导致pip自动给我更新了一大堆软件依赖(っ╥╯﹏╰╥c),虽然成功解决问题但是有点费时间,还不如下最低版本。

pip install causal-conv1d==1.1.0

解决方法3:用轮子安装。点进wheel URL显示的网址https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.1.3.post1/causal_conv1d-1.1.3.post1+cu118torch2.0cxx11abiFALSE-cp38-cp38-linux_x86_64.whl

手动下载whl文件,建议放在你的python第三方软件库文件夹下。然后pip install 路径/文件名安装:

root@202711992fa9:~# pip install /home/causal_conv1d-1.1.3.post1+cu118torch2.0cxx11abiFALSE-cp38-cp38-linux_x86_64.whl

安装完后我进入python测试了一下 import causal-conv1d没有报错,完美解决啦。

安装好causal-conv1d和mamba-ssm后运行mamba仍然报错

原因可能是除了这两个依赖外,还有一些静态链接库需要装。

解决办法:使用mamba-main这个目录下的setup.py文件,运行以下指令

python setup.py install

然后,就可以正常使用mamba模块啦,完美解决!

关于setuptools的报错

尝试在另一台环境类似的Linux服务器上运行mamba,安装causal-conv1d和mamba-ssm均出现报错,显示setuptools某一行语法错误:return (**args,....) ,推测是传参错误,很可能与setuptools的版本不匹配有关。

当前setuptools版本为68.2.2,回退到57.5.0,

pip install setuptools==57.5.0

解决!经过实测,回退到  49.4.0版本也可,所以在这两版本之间应该都可以匹配。

关于其他软件库依赖的问题报错

  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-a89an5hg/causal-conv1d_624cfb984a74428da389c74d883c2e5a/setup.py", line 10, in <module>
          from packaging.version import parse, Version
      ModuleNotFoundError: No module named 'packaging'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

这是缺少packaging模块,那就缺啥补啥,都给pip install 了就成。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐