Skip to content
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

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

Open
gmarko opened this issue Oct 22, 2024 · 2 comments
Open

Comments

@gmarko
Copy link

gmarko commented Oct 22, 2024

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

@JeS24
Copy link

JeS24 commented Oct 24, 2024

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:

for i in range(u.shape[2]):



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

mamba/setup.py

Lines 113 to 122 in bc84fb1

def check_if_cuda_home_none(global_option: str) -> None:
if CUDA_HOME is not None:
return
# warn instead of error because user could be downloading prebuilt wheels, so nvcc won't be necessary
# in that case.
warnings.warn(
f"{global_option} 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."
)

@felixniemeyer
Copy link

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.

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

3 participants