uoguelph-mlrg / PROTAX-GPU

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

Installation issues #26

Open hjarnek opened 3 days ago

hjarnek commented 3 days ago

Hi,

Thanks for updating the usage instructions! I'm facing problems with the installation on Linux (Ubuntu 24.04). For a start, I just want to try PROTAX-CPU. So I have created the conda environment and installed the requirements except for CUDA. But when I run pip install . I get the following error. Do you have any idea what's going on?

  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.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/protax
      copying src/protax/taxonomy.py -> build/lib.linux-x86_64-cpython-310/protax
      copying src/protax/baseline.py -> build/lib.linux-x86_64-cpython-310/protax
      copying src/protax/protax_utils.py -> build/lib.linux-x86_64-cpython-310/protax
      copying src/protax/model.py -> build/lib.linux-x86_64-cpython-310/protax
      copying src/protax/classify.py -> build/lib.linux-x86_64-cpython-310/protax
      copying src/protax/__init__.py -> build/lib.linux-x86_64-cpython-310/protax
      creating build/lib.linux-x86_64-cpython-310/knn_jax
      copying src/knn_jax/knn_jax.py -> build/lib.linux-x86_64-cpython-310/knn_jax
      copying src/knn_jax/__init__.py -> build/lib.linux-x86_64-cpython-310/knn_jax
      running 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
      reading manifest file 'protax.egg-info/SOURCES.txt'
      adding license file 'LICENSE'
      writing manifest file 'protax.egg-info/SOURCES.txt'
      running build_ext
      -- The CXX compiler identification is GNU 13.2.0
      CMake Error at /home/joel/.conda/envs/protax/share/cmake-3.30/Modules/Internal/CMakeCUDAFindToolkit.cmake:104 (message):
        Failed to find nvcc.

        Compiler requires the CUDA toolkit.  Please set the CUDAToolkit_ROOT
        variable.
      Call Stack (most recent call first):
        /home/joel/.conda/envs/protax/share/cmake-3.30/Modules/CMakeDetermineCUDACompiler.cmake:85 (cmake_cuda_find_toolkit)
        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 "/home/joel/PROTAX-GPU/setup.py", line 100, in <module>
          setup(
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/__init__.py", line 117, in setup
          return distutils.core.setup(**attrs)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
          self.run_command(cmd)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command
          super().run_command(command)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
          cmd_obj.run()
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/command/bdist_wheel.py", line 384, in run
          self.run_command("build")
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command
          super().run_command(command)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
          cmd_obj.run()
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
          self.run_command(cmd_name)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command
          super().run_command(command)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
          cmd_obj.run()
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 98, in run
          _build_ext.run(self)
        File "/home/joel/.local/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
          _build_ext.build_ext.run(self)
        File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
          self.build_extensions()
        File "/home/joel/PROTAX-GPU/setup.py", line 56, in build_extensions
          subprocess.check_call(
        File "/home/joel/.conda/envs/protax/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['cmake', '/home/joel/PROTAX-GPU', '-DCMAKE_INSTALL_PREFIX=/home/joel/PROTAX-GPU/build/lib.linux-x86_64-cpython-310', '-DPython_EXECUTABLE=/home/joel/.conda/envs/protax/bin/python3.10', '-DPython_LIBRARIES=/home/joel/.conda/envs/protax/lib/libpython3.10.a', '-DPython_INCLUDE_DIRS=/home/joel/.conda/envs/protax/include/python3.10', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_PREFIX_PATH=/home/joel/.conda/envs/protax/lib/python3.10/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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (protax)
gwtaylor commented 3 days ago

Hi @hjarnek The key part of that message is here:

      CMake Error at /home/joel/.conda/envs/protax/share/cmake-3.30/Modules/Internal/CMakeCUDAFindToolkit.cmake:104 (message):
        Failed to find nvcc.

        Compiler requires the CUDA toolkit.  Please set the CUDAToolkit_ROOT
        variable.

It seems that it is looking for the CUDA toolkit even though you stated that you want to just use the CPU fallback.

Can you confirm that you ran pip install "jax[cpu]"? If you can provide any more info about your environment setup, or earlier steps before cloning the PROTAX-GPU repo and installing requirements.txt and pip install . that would be helpful for us to see what is going on.

hjarnek commented 3 days ago

Yes, I ran pip install "jax[cpu]". If I run it again, I only get Requirement already satisfied.

I just deleted the repo folder and conda environment and tried to install it from scratch again. The error seems to occur during installation of requirements.txt, which yields:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pyppeteer 2.0.0 requires appdirs<2.0.0,>=1.4.3, which is not installed.
pyppeteer 2.0.0 requires importlib-metadata>=1.4, which is not installed.
Cleanliness commented 3 days ago

Hi,

I think the issue may be on our end. Based on the output trying to search for CUDA toolkit, it looks like the problem is in CMakelists.txt (lines 12-24)

# if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" AND CMAKE_SYSTEM_NAME MATCHES "Darwin")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
    message(STATUS "Mac detected. Skipping CUDA configuration.")
    set(CUDA_FOUND OFF)
else()
    enable_language(CUDA)
    find_package(CUDA)
    if (CUDA_FOUND)
        include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
    else()
        message(WARNING "CUDA not found or not supported. Skipping GPU ops.")
    endif()
endif()

In short, we are calling enable_language(CUDA) even though it isn't guaranteed that the cuda toolkit has been located. If I recall correctly, when we do this cmake attempts building a simple CUDA program with nvcc to test, which wouldn't be on your system. Can you try changing this to put it inside the CUDA_FOUND block and see if this works for you? i.e:

# if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" AND CMAKE_SYSTEM_NAME MATCHES "Darwin")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
    message(STATUS "Mac detected. Skipping CUDA configuration.")
    set(CUDA_FOUND OFF)
else()
    find_package(CUDA)
    if (CUDA_FOUND)
        enable_language(CUDA)       # Move to here
        include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
    else()
        message(WARNING "CUDA not found or not supported. Skipping GPU ops.")
    endif()
endif()

I tested this change on a colab CPU instance and was able to get it to build.

hjarnek commented 3 days ago

@Cleanliness – I tried and got the following wall of text error. I guess it has something to do with the pyppeteer error above.

pip install . error ```bash Building wheel for protax (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [109 lines of output] running bdist_wheel running build running build_py creating build/lib.linux-x86_64-cpython-310/protax copying src/protax/taxonomy.py -> build/lib.linux-x86_64-cpython-310/protax copying src/protax/baseline.py -> build/lib.linux-x86_64-cpython-310/protax copying src/protax/protax_utils.py -> build/lib.linux-x86_64-cpython-310/protax copying src/protax/model.py -> build/lib.linux-x86_64-cpython-310/protax copying src/protax/classify.py -> build/lib.linux-x86_64-cpython-310/protax copying src/protax/__init__.py -> build/lib.linux-x86_64-cpython-310/protax creating build/lib.linux-x86_64-cpython-310/knn_jax copying src/knn_jax/knn_jax.py -> build/lib.linux-x86_64-cpython-310/knn_jax copying src/knn_jax/__init__.py -> build/lib.linux-x86_64-cpython-310/knn_jax running 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 reading manifest file 'protax.egg-info/SOURCES.txt' adding license file 'LICENSE' writing manifest file 'protax.egg-info/SOURCES.txt' running build_ext -- The CXX compiler identification is GNU 13.2.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using CMake version 3.30.4 /home/joel/PROTAX-GPU -- Found Python: /home/joel/.conda/envs/protax/bin/python3.10 (found version "3.10.15") found components: Interpreter Development Development.Module Development.Embed -- Performing Test HAS_FLTO -- Performing Test HAS_FLTO - Success -- Found pybind11: /home/joel/.conda/envs/protax/lib/python3.10/site-packages/pybind11/include (found version "2.13.6") CMake Warning (dev) at CMakeLists.txt:17 (find_package): Policy CMP0146 is not set: The FindCUDA module is removed. Run "cmake --help-policy CMP0146" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it. CUDA_TOOLKIT_ROOT_DIR not found or specified -- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) CMake Warning at CMakeLists.txt:22 (message): CUDA not found or not supported. Skipping GPU ops. -- Skipping GPU ops build since CUDA is not available. -- Configuring done (0.6s) -- Generating done (0.0s) -- Build files have been written to: /home/joel/PROTAX-GPU/build/temp.linux-x86_64-cpython-310 [ 50%] Building CXX object CMakeFiles/cpu_ops.dir/lib/knn_cpu.cpp.o [100%] Linking CXX shared module cpu_ops.cpython-310-x86_64-linux-gnu.so lto-wrapper: warning: using serial compilation of 2 LTRANS jobs lto-wrapper: note: see the ‘-flto’ option documentation for more information [100%] Built target cpu_ops gmake: *** Ingen regel för att skapa målet ”gpu_ops”. Stannar. Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/home/joel/PROTAX-GPU/setup.py", line 107, in setup( File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/__init__.py", line 117, in setup return distutils.core.setup(**attrs) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 183, in setup return run_commands(dist) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 199, in run_commands dist.run_commands() File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands self.run_command(cmd) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command super().run_command(command) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command cmd_obj.run() File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/command/bdist_wheel.py", line 398, in run self.run_command("build") File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command self.distribution.run_command(command) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command super().run_command(command) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command cmd_obj.run() File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command self.distribution.run_command(command) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/dist.py", line 950, in run_command super().run_command(command) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 973, in run_command cmd_obj.run() File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 98, in run _build_ext.run(self) File "/home/joel/.local/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run self.build_extensions() File "/home/joel/PROTAX-GPU/setup.py", line 68, in build_extensions super().build_extensions() File "/home/joel/.local/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 476, in build_extensions self._build_extensions_serial() File "/home/joel/.conda/envs/protax/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 502, in _build_extensions_serial self.build_extension(ext) File "/home/joel/PROTAX-GPU/setup.py", line 79, in build_extension subprocess.check_call( File "/home/joel/.conda/envs/protax/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'gpu_ops']' returned non-zero exit status 2. [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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (protax) ```