Skip to content

导入mamba时的bug #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Pulp-fiction-42 opened this issue Mar 31, 2025 · 7 comments
Open

导入mamba时的bug #714

Pulp-fiction-42 opened this issue Mar 31, 2025 · 7 comments

Comments

@Pulp-fiction-42
Copy link

你好,当我在conda配置好环境后,尝试在python中
import mamba_ssm
遇到了下面报错

>>> import mamba_ssm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/home/bgi_fangc/PROJ/mamba/mamba_ssm/__init__.py", line 3, in <module>
    from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn
  File "/share/home/bgi_fangc/PROJ/mamba/mamba_ssm/ops/selective_scan_interface.py", line 18, in <module>
    import selective_scan_cuda  # <--- 问题发生在这里
ImportError: /share/home/bgi_fangc/miniforge3/envs/mamba_base/lib/python3.10/site-packages/selective_scan_cuda.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3c107WarningC1ESt7variantIJNS0_11UserWarningENS0_18DeprecationWarningEEERKNS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb

这个bug是什么原因导致的能请教一下吗?

@kongtiaochengtailang
Copy link

What's the version of torch? Maybe you could try building and installing it from source code instead.

@Pulp-fiction-42
Copy link
Author

What's the version of torch? Maybe you could try building and installing it from source code instead.

both these two wheel file

mamba_ssm-2.2.2+cu118torch2.3cxx11abiTRUE-cp310-cp310-linux_x86_64.whl`
mamba_ssm-2.2.2+cu118torch2.3cxx11abiFALSE-cp310-cp310-linux_x86_64.whl

and then I use
pip install wheel_file
I ask for the Gemini, and the AI said that most probably my torch version don't be right,I check it for twice

>>> torch.__version__
'2.3.0+cu118'

@KeruiLiu-AI
Copy link

你好,当我在conda配置好环境后,尝试在python中 import mamba_ssm 遇到了下面报错

>>> import mamba_ssm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/home/bgi_fangc/PROJ/mamba/mamba_ssm/__init__.py", line 3, in <module>
    from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn
  File "/share/home/bgi_fangc/PROJ/mamba/mamba_ssm/ops/selective_scan_interface.py", line 18, in <module>
    import selective_scan_cuda  # <--- 问题发生在这里
ImportError: /share/home/bgi_fangc/miniforge3/envs/mamba_base/lib/python3.10/site-packages/selective_scan_cuda.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3c107WarningC1ESt7variantIJNS0_11UserWarningENS0_18DeprecationWarningEEERKNS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb

这个bug是什么原因导致的能请教一下吗?

Hello, have you solved it? I have also encountered this problem. I would be grateful if you could answer me.

@Pulp-fiction-42
Copy link
Author

你好,当我在conda配置好环境后,尝试在python中 import mamba_ssm 遇到了下面报错

>>> import mamba_ssm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/share/home/bgi_fangc/PROJ/mamba/mamba_ssm/__init__.py", line 3, in <module>
    from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn
  File "/share/home/bgi_fangc/PROJ/mamba/mamba_ssm/ops/selective_scan_interface.py", line 18, in <module>
    import selective_scan_cuda  # <--- 问题发生在这里
ImportError: /share/home/bgi_fangc/miniforge3/envs/mamba_base/lib/python3.10/site-packages/selective_scan_cuda.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN3c107WarningC1ESt7variantIJNS0_11UserWarningENS0_18DeprecationWarningEEERKNS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb

这个bug是什么原因导致的能请教一下吗?

Hello, have you solved it? I have also encountered this problem. I would be grateful if you could answer me.

yes I have solved.That is because you should download the "application binary interface: False" version wheel file.It can avoid the bug: undefined symbol in selective_scan_cuda.cpython-310-x86_64-linux-gnu.so.I hope it can help you.If you have any problem please leave the comment.

@xiezhipeng-git
Copy link

xiezhipeng-git commented May 28, 2025

Source code installation
pytorch 2.6.0 same error

ImportError                               Traceback (most recent call last)
Cell In[4], [line 1](vscode-notebook-cell:?execution_count=4&line=1)
----> [1](vscode-notebook-cell:?execution_count=4&line=1) from mamba_ssm import Mamba2 as Mamba

File ~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:3
      [1](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:1) __version__ = "2.2.4"
----> [3](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:3) from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn
      [4](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:4) from mamba_ssm.modules.mamba_simple import Mamba
      [5](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:5) from mamba_ssm.modules.mamba2 import Mamba2

File ~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:20
     [16](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:16)     causal_conv1d_update_function = None
     [18](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:18) from mamba_ssm.ops.triton.layer_norm import _layer_norm_fwd
---> [20](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:20) import selective_scan_cuda
     [23](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:23) class SelectiveScanFn(torch.autograd.Function):
     [25](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:25)     @staticmethod
     [26](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:26)     def forward(ctx, u, delta, A, B, C, D=None, z=None, delta_bias=None, delta_softplus=False,
     [27](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:27)                 return_last_state=False):

ImportError: /root/anaconda3/lib/python3.12/site-packages/selective_scan_cuda.cpython-312-x86_64-linux-gnu.so: undefined symbol: _ZN3c107WarningC1ESt7variantIJNS0_11UserWarningENS0_18DeprecationWarningEEERKNS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb

@Pulp-fiction-42
Copy link
Author

It was the ABI interface error.Use the "False" version of pytorch

@Pulp-fiction-42
Copy link
Author

Source code installation
pytorch 2.6.0 same error

ImportError                               Traceback (most recent call last)
Cell In[4], [line 1](vscode-notebook-cell:?execution_count=4&line=1)
----> [1](vscode-notebook-cell:?execution_count=4&line=1) from mamba_ssm import Mamba2 as Mamba

File ~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:3
      [1](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:1) __version__ = "2.2.4"
----> [3](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:3) from mamba_ssm.ops.selective_scan_interface import selective_scan_fn, mamba_inner_fn
      [4](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:4) from mamba_ssm.modules.mamba_simple import Mamba
      [5](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/__init__.py:5) from mamba_ssm.modules.mamba2 import Mamba2

File ~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:20
     [16](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:16)     causal_conv1d_update_function = None
     [18](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:18) from mamba_ssm.ops.triton.layer_norm import _layer_norm_fwd
---> [20](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:20) import selective_scan_cuda
     [23](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:23) class SelectiveScanFn(torch.autograd.Function):
     [25](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:25)     @staticmethod
     [26](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:26)     def forward(ctx, u, delta, A, B, C, D=None, z=None, delta_bias=None, delta_softplus=False,
     [27](https://vscode-remote+wsl-002bubuntu-002d24-002e04.vscode-resource.vscode-cdn.net/mnt/d/my/work/rlFrame/rl_frame/envpoolTest/~/anaconda3/lib/python3.12/site-packages/mamba_ssm/ops/selective_scan_interface.py:27)                 return_last_state=False):

ImportError: /root/anaconda3/lib/python3.12/site-packages/selective_scan_cuda.cpython-312-x86_64-linux-gnu.so: undefined symbol: _ZN3c107WarningC1ESt7variantIJNS0_11UserWarningENS0_18DeprecationWarningEEERKNS_14SourceLocationENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb

It was the ABI interface error.Use the "False" version of pytorch__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants