mamba icon indicating copy to clipboard operation
mamba copied to clipboard

"Installation error: 'bare_metal_version' not defined in mamba_ssm setup.py"

Open gmarko opened this issue 1 year ago • 3 comments

I encountered an error while trying to install the mamba_ssm package (version 2.2.2) using pip. The installation fails with a NameError, indicating that the variable bare_metal_version is not defined in the setup.py script. Here are the details of my environment: Operating System: [Specify your operating system and version] Python Version: [Specify your Python version] PyTorch Version: 1.13.1+cu117 Steps to reproduce the error: Create a new virtual environment (optional but recommended). Activate the virtual environment. Run the following command to install mamba_ssm:

pip install mamba_ssm==2.2.2

The installation process fails with the following error:

`/tmp/pip-install-ogtmafks/mamba-ssm_fa1e7fb3478e4f2c98a605ddfb1e5d62/setup.py:119: UserWarning: mamba_ssm was requested, but nvcc was not found. Are you sure your environment has nvcc available? If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc. warnings.warn( Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-ogtmafks/mamba-ssm_fa1e7fb3478e4f2c98a605ddfb1e5d62/setup.py", line 189, in if bare_metal_version >= Version("11.8"): NameError: name 'bare_metal_version' is not defined

torch.__version__  = 1.13.1+cu117


[end of output]`

Title: "NameError: 'bare_metal_version' is not defined during mamba_ssm installation"

Description: I encountered an error while trying to install the mamba_ssm package (version 2.2.2) using pip. The installation fails with a NameError, indicating that the variable bare_metal_version is not defined in the setup.py script.

Here are the details of my environment:

  • Operating System: [Specify your operating system and version]
  • Python Version: [Specify your Python version]
  • PyTorch Version: 1.13.1+cu117

Steps to reproduce the error:

  1. Create a new virtual environment (optional but recommended).
  2. Activate the virtual environment.
  3. Run the following command to install mamba_ssm:
    pip install mamba_ssm==2.2.2
    

The installation process fails with the following error:

/tmp/pip-install-ogtmafks/mamba-ssm_fa1e7fb3478e4f2c98a605ddfb1e5d62/setup.py:119: UserWarning: mamba_ssm was requested, but nvcc was not found.  Are you sure your environment has nvcc available?  If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc.
      warnings.warn(
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/tmp/pip-install-ogtmafks/mamba-ssm_fa1e7fb3478e4f2c98a605ddfb1e5d62/setup.py", line 189, in <module>
        if bare_metal_version >= Version("11.8"):
    NameError: name 'bare_metal_version' is not defined


    torch.__version__  = 1.13.1+cu117


    [end of output]

this is error line: if bare_metal_version >= Version("11.8"):

It appears that the setup.py script is trying to access a variable named bare_metal_version, but this variable is not defined, resulting in the NameError.

I also noticed a warning message indicating that nvcc (NVIDIA CUDA Compiler) was not found. However, I don't have CUDA installed and I don't require CUDA support for my use case.

Thank you for your attention to this matter.

Best regards, Marco Durán, Anachroni

gmarko avatar Oct 22 '24 17:10 gmarko

Mamba requires CUDA (see Installation requirements) or its equivalent, ROCm, on AMD cards (see this).

Technically, you could download the mamba source from here and separately run the PyTorch reference code for selective scan (without installing - just use imports), defined as selective_scan_ref() here, on CPU or in a CUDA-less environment, but it's going to be excruciatingly slow because of this for loop over the input sequence:

https://github.com/state-spaces/mamba/blob/bc84fb1172e6dea04a7dc402118ed19985349e95/mamba_ssm/ops/selective_scan_interface.py#L138



Sidenote: Perhaps check_if_cuda_home_none() (or the check at L188) should raise a RuntimeError instead of a warning.

https://github.com/state-spaces/mamba/blob/bc84fb1172e6dea04a7dc402118ed19985349e95/setup.py#L113-L122

JeS24 avatar Oct 24 '24 04:10 JeS24

I was running into the same issue. I too have set up a virtualenv with

  • python 3.10
  • CUDA 11.7
  • torch 1.13.1

tl;dr: I was missing nvcc like the error message suggested and could simply fix that by installing it with my operating system package manager.


I was trying to install mamba_ssm 1.0.1.

Since I have torch and cuda in my venv, I'm puzzled why I'm getting this error:

pip install mamba_ssm==1.0.1   
Collecting mamba_ssm==1.0.1
  Downloading mamba_ssm-1.0.1.tar.gz (28 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      /tmp/pip-install-q7303r4m/mamba-ssm_4897e5fd75eb4e209afaa8571579274d/setup.py:77: UserWarning: mamba_ssm was requested, but nvcc was not found.  Are you sure your environment has nvcc available?  If you're installing within a container from https://hub.docker.com/r/pytorch/pytorch, only images whose names contain 'devel' will provide nvcc.
        warnings.warn(
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-q7303r4m/mamba-ssm_4897e5fd75eb4e209afaa8571579274d/setup.py", line 111, in <module>
          if bare_metal_version >= Version("11.8"):
      NameError: name 'bare_metal_version' is not defined
      
      
      torch.__version__  = 1.13.1+cu117
      
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

This part made me check whether I have the nvcc command available in my shell:

UserWarning: mamba_ssm was requested, but nvcc was not found. 

... and I hadn't.

PyTorch CUDA does not include cuda-tools like nvcc.

I installed it with pacman -S cuda cuda-tools (actually yay -S cuda-11.7, because that's the cuda version I was trying to use), after which pip install mamba_ssm==1.0.1 worked. I had to open a new terminal after installing cuda in order for nvcc to become known.

felixniemeyer avatar Oct 27 '24 15:10 felixniemeyer

I get NameError: name 'bare_metal_version' is not defined during installation but nvcc --version gives nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2025 NVIDIA Corporation Built on Wed_Apr__9_19:29:17_Pacific_Daylight_Time_2025 Cuda compilation tools, release 12.9, V12.9.41 Build cuda_12.9.r12.9/compiler.35813241_0

alicemabille avatar Aug 27 '25 10:08 alicemabille