uoguelph-mlrg / PROTAX-GPU

GPU-accelerated DNA barcode classification
Other
8 stars 1 forks source link

Mac ARM CPU support fails looking for nvcc #18

Closed gwtaylor closed 1 month ago

gwtaylor commented 1 year ago

With #7 (CPU fallback) implemented I thought I would try it out.

When I run pip install . it complains about not finding nvcc, which is unexpected:

Environment creation:

conda create -n protax-gpu pip pybind11 pandas
conda activate protax-gpu
pip install --upgrade "jax[cpu]" chex

Wheel creation:

cd ~/src/PROTAX-GPU
pip install .
Processing /Users/gwtaylor/src/PROTAX-GPU
  Preparing metadata (setup.py) ... done
Requirement already satisfied: jax in /opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages (from protax==0.0.0) (0.4.20)
Requirement already satisfied: jaxlib in /opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages (from protax==0.0.0) (0.4.20)
Requirement already satisfied: ml-dtypes>=0.2.0 in /opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages (from jax->protax==0.0.0) (0.3.1)
Requirement already satisfied: numpy>=1.22 in /opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages (from jax->protax==0.0.0) (1.26.0)
Requirement already satisfied: opt-einsum in /opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages (from jax->protax==0.0.0) (3.3.0)
Requirement already satisfied: scipy>=1.9 in /opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages (from jax->protax==0.0.0) (1.11.4)
Building wheels for collected packages: protax
  Building wheel for protax (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [80 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-312
      creating build/lib.macosx-11.0-arm64-cpython-312/protax
      copying src/protax/protax_utils.py -> build/lib.macosx-11.0-arm64-cpython-312/protax
      copying src/protax/baseline.py -> build/lib.macosx-11.0-arm64-cpython-312/protax
      copying src/protax/classify.py -> build/lib.macosx-11.0-arm64-cpython-312/protax
      copying src/protax/__init__.py -> build/lib.macosx-11.0-arm64-cpython-312/protax
      copying src/protax/model.py -> build/lib.macosx-11.0-arm64-cpython-312/protax
      copying src/protax/taxonomy.py -> build/lib.macosx-11.0-arm64-cpython-312/protax
      creating build/lib.macosx-11.0-arm64-cpython-312/knn_jax
      copying src/knn_jax/knn_jax.py -> build/lib.macosx-11.0-arm64-cpython-312/knn_jax
      copying src/knn_jax/__init__.py -> build/lib.macosx-11.0-arm64-cpython-312/knn_jax
      running egg_info
      creating protax.egg-info
      writing protax.egg-info/PKG-INFO
      writing dependency_links to protax.egg-info/dependency_links.txt
      writing requirements to protax.egg-info/requires.txt
      writing top-level names to protax.egg-info/top_level.txt
      writing manifest file 'protax.egg-info/SOURCES.txt'
      reading manifest file 'protax.egg-info/SOURCES.txt'
      writing manifest file 'protax.egg-info/SOURCES.txt'
      running build_ext
      -- The CXX compiler identification is AppleClang 15.0.0.15000040
      CMake Error at /opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/CMakeDetermineCUDACompiler.cmake:180 (message):
        Failed to find nvcc.

        Compiler requires the CUDA toolkit.  Please set the CUDAToolkit_ROOT
        variable.
      Call Stack (most recent call first):
        CMakeLists.txt:2 (project)

      -- Configuring incomplete, errors occurred!
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/Users/gwtaylor/src/PROTAX-GPU/setup.py", line 100, in <module>
          setup(
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 369, in run
          self.run_command("build")
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/Users/gwtaylor/src/PROTAX-GPU/setup.py", line 56, in build_extensions
          subprocess.check_call(
        File "/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/Users/gwtaylor/src/PROTAX-GPU', '-DCMAKE_INSTALL_PREFIX=/Users/gwtaylor/src/PROTAX-GPU/build/lib.macosx-11.0-arm64-cpython-312', '-DPython_EXECUTABLE=/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/bin/python3.12', '-DPython_LIBRARIES=/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/libpython3.12.a', '-DPython_INCLUDE_DIRS=/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/include/python3.12', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_PREFIX_PATH=/opt/homebrew/Caskroom/miniforge/base/envs/protax-gpu/lib/python3.12/site-packages/pybind11/share/cmake/pybind11']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for protax
  Running setup.py clean for protax
Failed to build protax
ERROR: Could not build wheels for protax, which is required to install pyproject.toml-based projects