Skip to content

stamp[gpu] installation errors #125

@cglasner

Description

@cglasner

Hi everyone!
I'm unable to install STAMP (GPU version) on a Ubuntu 24 machine from the current main-branch when following the README's instructions.

The instructions under "Install STAMP in a Virtual Environment" lead to the following error when executing uv pip install "git+https://github.com/KatherLab/STAMP.git[gpu]":

Resolved 145 packages in 724ms
  × Failed to build `flash-attn==2.8.3`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)

      [stderr]
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "/home/cglasner/.cache/uv/builds-v0/.tmpehBBRK/lib/python3.12/site-packages/setuptools/build_meta.py", line 331, in
      get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/cglasner/.cache/uv/builds-v0/.tmpehBBRK/lib/python3.12/site-packages/setuptools/build_meta.py", line 301, in
      _get_build_requires
          self.run_setup()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpehBBRK/lib/python3.12/site-packages/setuptools/build_meta.py", line 512, in
      run_setup
          super().run_setup(setup_script=setup_script)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpehBBRK/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in
      run_setup
          exec(code, locals())
        File "<string>", line 22, in <module>
      ModuleNotFoundError: No module named 'torch'

      hint: This error likely indicates that `flash-attn@2.8.3` depends on `torch`, but doesn't declare it as a build dependency. If
      `flash-attn` is a first-party package, consider adding `torch` to its `build-system.requires`. Otherwise, either add it to your
      `pyproject.toml` under:

      [tool.uv.extra-build-dependencies]
      flash-attn = ["torch"]

      or `uv pip install torch` into the environment and re-run with `--no-build-isolation`.
  help: `flash-attn` (v2.8.3) was included because `stamp[gpu]` (v2.3.0) depends on `flash-attn`

Meanwhile the instructions under "Install STAMP from the Repository" lead to the following error when executing uv sync --extra build --extra gpu:

(... a bunch of outputs starting with ptxas info before this, and then:)
      ninja: build stopped: subcommand failed.

      [stderr]
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/_subclasses/functional_tensor.py:276:
      UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at
      /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.)
        cpu = _conversion_method_template(device=torch.device("cpu"))
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:82:
      SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
      !!

              ********************************************************************************
              Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`.
      (Both options available on setuptools>=77.0.0).

              By 2026-Feb-18, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        corresp(dist, value, root_dir)
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:82:
      SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies)
        corresp(dist, value, root_dir)
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:61:
      SetuptoolsDeprecationWarning: License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: Apache Software License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        dist._finalize_license_expression()
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/dist.py:759: SetuptoolsDeprecationWarning:
      License classifiers are deprecated.
      !!

              ********************************************************************************
              Please consider removing the following classifiers in favor of a SPDX license expression:

              License :: OSI Approved :: Apache Software License

              See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
              ********************************************************************************

      !!
        self._finalize_license_expression()
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py:480: UserWarning: The
      detected CUDA version (12.0) has a minor version mismatch with the version that was used to compile PyTorch (12.6). Most likely
      this shouldn't be a problem.
        warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
      /home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py:490: UserWarning: There
      are no x86_64-linux-gnu-g++ version bounds defined for CUDA version 12.0
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      Emitting ninja build file
      /home/cglasner/.cache/uv/git-v0/checkouts/7028b40354a6e896/d0d4192/build/temp.linux-x86_64-cpython-312/build.ninja...
      Compiling objects...
      Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
      Traceback (most recent call last):
        File "<string>", line 331, in run
        File "/usr/lib/python3.12/urllib/request.py", line 240, in urlretrieve
          with contextlib.closing(urlopen(url, data)) as fp:
                                  ^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
          return opener.open(url, data, timeout)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/urllib/request.py", line 521, in open
          response = meth(req, response)
                     ^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/urllib/request.py", line 630, in http_response
          response = self.parent.error(
                     ^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/urllib/request.py", line 559, in error
          return self._call_chain(*args)
                 ^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
          result = func(*args)
                   ^^^^^^^^^^^
        File "/usr/lib/python3.12/urllib/request.py", line 639, in http_error_default
          raise HTTPError(req.full_url, code, msg, hdrs, fp)
      urllib.error.HTTPError: HTTP Error 404: Not Found

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 2506,
      in _run_ninja_build
          subprocess.run(
        File "/usr/lib/python3.12/subprocess.py", line 571, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "<string>", line 11, in <module>
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/build_meta.py", line 432, in
      build_wheel
          return _build(['bdist_wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/build_meta.py", line 423, in
      _build
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/build_meta.py", line 404, in
      _build_with_temp_dir
          self.run_setup()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in
      run_setup
          exec(code, locals())
        File "<string>", line 353, in <module>
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/__init__.py", line 115, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 186,
      in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 202,
      in run_commands
          dist.run_commands()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1002,
      in run_commands
          self.run_command(cmd)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/dist.py", line 1102, in
      run_command
          super().run_command(command)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1021,
      in run_command
          cmd_obj.run()
        File "<string>", line 345, in run
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/command/bdist_wheel.py", line 370,
      in run
          self.run_command("build")
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 357,
      in run_command
          self.distribution.run_command(command)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/dist.py", line 1102, in
      run_command
          super().run_command(command)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1021,
      in run_command
          cmd_obj.run()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line
      135, in run
          self.run_command(cmd_name)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 357,
      in run_command
          self.distribution.run_command(command)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/dist.py", line 1102, in
      run_command
          super().run_command(command)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 1021,
      in run_command
          cmd_obj.run()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 96,
      in run
          _build_ext.run(self)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py",
      line 368, in run
          self.build_extensions()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 1010,
      in build_extensions
          build_ext.build_extensions(self)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py",
      line 484, in build_extensions
          self._build_extensions_serial()
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py",
      line 510, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 261,
      in build_extension
          _build_ext.build_extension(self, ext)
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py",
      line 565, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 815,
      in unix_wrap_ninja_compile
          _write_ninja_file_and_compile_objects(
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 2159, in
      _write_ninja_file_and_compile_objects
          _run_ninja_build(
        File "/home/cglasner/.cache/uv/builds-v0/.tmpGOdyfo/lib/python3.12/site-packages/torch/utils/cpp_extension.py", line 2522,
      in _run_ninja_build
          raise RuntimeError(message) from e
      RuntimeError: Error compiling objects for extension

      hint: This usually indicates a problem with the package or the build environment.
  help: `mamba-ssm` was included because `stamp[gpu]` (v2.3.0) depends on `mamba-ssm`

Some extra info:

  • I'm behind a HTTP proxy and the errors thrown in request.py when installing from the local repository to me suggest that may at least be part of the issue. However I have proxy-related environment variables properly set for uv (I was e.g. able to run uv self update without issues) and other python environments so I don't know how I would resolve that.
  • Installing the CPU version with uv works without issues. But I would obviously prefer GPU support.
  • My current workaround is to install stamp[all] via pip, i.e. run pip install "stamp[all] @ git+https://github.com/KatherLab/STAMP.git". This at least gets me some, but not all GPU functionality (installing the GPU version via pip does not work either).

Any help and hints in getting the GPU version of STAMP to install would be great. Bonus extra glitter star points if it works with pip and no uv, but either way is fine. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions