AMYPAD / NumCu

Numerical CUDA-based Python library
https://amypad.github.io/NumCu
Other
2 stars 0 forks source link

Cannot install numcu with pip #3

Open tctco opened 1 year ago

tctco commented 1 year ago

I tried to install niftypet with pip and got this error when installing numcu: error: identifier "FLOAT_MAX" is undefined in device code.

Here is the complete error log

Building wheels for collected packages: numcu
  Building wheel for numcu (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for numcu (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [218 lines of output]

      --------------------------------------------------------------------------------
      -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      -- The C compiler identification is unknown
      CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
        No CMAKE_C_COMPILER could be found.

        Tell CMake where to find the compiler by setting either the environment
        variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
        the compiler, or to the compiler name if it is in the PATH.

      -- Configuring incomplete, errors occurred!
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure
      --------------------------------------------------------------------------------

      --------------------------------------------------------------------------------
      -- Trying 'Visual Studio 17 2022 x64 v143' generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      CMake Error at CMakeLists.txt:2 (PROJECT):
        Generator

          Visual Studio 17 2022

        could not find any instance of Visual Studio.

      -- Configuring incomplete, errors occurred!
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure
      --------------------------------------------------------------------------------

      --------------------------------------------------------------------------------
      -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator
      --------------------------------
      ---------------------------
      ----------------------
      -----------------
      ------------
      -------
      --
      Not searching for unused variables given on the command line.
      CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      -- The C compiler identification is MSVC 19.29.30136.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- The CXX compiler identification is MSVC 19.29.30136.0
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Configuring done (2.0s)
      -- Generating done (0.0s)
      -- Build files have been written to: C:/Users/xxx/AppData/Local/Temp/pip-install-h62ogs7n/numcu_9ecc5ff6ffef44b993dd44ff8be54206/_cmake_test_compile/build
      --
      -------
      ------------
      -----------------
      ----------------------
      ---------------------------
      --------------------------------
      -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - success
      --------------------------------------------------------------------------------

      Configuring Project
        Working directory:
          C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\_skbuild\win-amd64-3.10\cmake-build
        Command:
          'C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\cmake\data\bin/cmake.exe' 'C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\numcu' -G Ninja '-DCMAKE_MAKE_PROGRAM:FILEPATH=C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\ninja\data\bin\ninja' -D_SKBUILD_FORCE_MSVC=1920 --no-warn-unused-cli '-DCMAKE_INSTALL_PREFIX:PATH=C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\_skbuild\win-amd64-3.10\cmake-install' -DPYTHON_VERSION_STRING:STRING=3.10.13 -DSKBUILD:INTERNAL=TRUE '-DCMAKE_MODULE_PATH:PATH=C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\skbuild\resources\cmake' '-DPYTHON_EXECUTABLE:PATH=E:\programs\Anaconda\envs\playground\python.exe' '-DPYTHON_INCLUDE_DIR:PATH=E:\programs\Anaconda\envs\playground\Include' '-DPYTHON_LIBRARY:PATH=E:\programs\Anaconda\envs\playground\libs\python310.lib' '-DPython_EXECUTABLE:PATH=E:\programs\Anaconda\envs\playground\python.exe' '-DPython_ROOT_DIR:PATH=E:\programs\Anaconda\envs\playground' -DPython_FIND_REGISTRY:STRING=NEVER '-DPython_INCLUDE_DIR:PATH=E:\programs\Anaconda\envs\playground\Include' '-DPython_LIBRARY:PATH=E:\programs\Anaconda\envs\playground\libs\python310.lib' '-DPython_NumPy_INCLUDE_DIRS:PATH=C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\numpy\core\include' '-DPython3_EXECUTABLE:PATH=E:\programs\Anaconda\envs\playground\python.exe' '-DPython3_ROOT_DIR:PATH=E:\programs\Anaconda\envs\playground' -DPython3_FIND_REGISTRY:STRING=NEVER '-DPython3_INCLUDE_DIR:PATH=E:\programs\Anaconda\envs\playground\Include' '-DPython3_LIBRARY:PATH=E:\programs\Anaconda\envs\playground\libs\python310.lib' '-DPython3_NumPy_INCLUDE_DIRS:PATH=C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\numpy\core\include' '-DCMAKE_MAKE_PROGRAM:FILEPATH=C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\ninja\data\bin\ninja' -DNUMCU_BUILD_VERSION=1.0.5 '-DPython3_ROOT_DIR=E:\programs\Anaconda\envs\playground' -DCMAKE_CUDA_ARCHITECTURES=86 -DCMAKE_BUILD_TYPE:STRING=Release

      Not searching for unused variables given on the command line.
      -- The C compiler identification is MSVC 19.29.30136.0
      -- The CXX compiler identification is MSVC 19.29.30136.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x64/cl.exe - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found Python3: E:/programs/Anaconda/envs/playground/python.exe (found version "3.10.13") found components: Interpreter Development Development.Module Development.Embed     
      -- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/include (found version "11.6.112")
      -- The CUDA compiler identification is NVIDIA 11.6.112
      -- Detecting CUDA compiler ABI info
      -- Detecting CUDA compiler ABI info - done
      -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/bin/nvcc.exe - skipped
      -- Detecting CUDA compile features
      -- Detecting CUDA compile features - done
      C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\cuvec\__init__.py:39: UserWarning: No module named 'cuvec.cuvec'
        warn(str(err), UserWarning)
      -- Found cuvec includes: C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\cuvec\include
      CMake Warning (dev) at C:/Users/xxx/AppData/Local/Temp/pip-build-env-y07g4e82/overlay/Lib/site-packages/skbuild/resources/cmake/FindPythonExtensions.cmake:245 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        CMakeLists.txt:39 (find_package)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Found PythonInterp: E:/programs/Anaconda/envs/playground/python.exe (found version "3.10.13")
      CMake Warning (dev) at C:/Users/xxx/AppData/Local/Temp/pip-build-env-y07g4e82/overlay/Lib/site-packages/skbuild/resources/cmake/FindPythonExtensions.cmake:252 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        CMakeLists.txt:39 (find_package)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Found PythonLibs: E:/programs/Anaconda/envs/playground/libs/python310.lib (found version "3.10.13")
      -- CUDA architectures: 86
      -- Build type: Release
      -- CuVec debugging: OFF
      -- Performing Test Weak Link SHARED -> SHARED (gnu_ld_ignore) - Failed
      -- Performing Test Weak Link SHARED -> SHARED (osx_dynamic_lookup) - Failed
      -- Performing Test Weak Link SHARED -> SHARED (no_flag) - Failed
      -- Configuring done (22.6s)
      -- Generating done (0.0s)
      -- Build files have been written to: C:/Users/xxx/AppData/Local/Temp/pip-install-h62ogs7n/numcu_9ecc5ff6ffef44b993dd44ff8be54206/_skbuild/win-amd64-3.10/cmake-build
      [1/4] Building CUDA object CMakeFiles\numcu.dir\src\elemwise.cu.obj
      FAILED: CMakeFiles/numcu.dir/src/elemwise.cu.obj
      C:\PROGRA~1\NVIDIA~2\CUDA\v11.6\bin\nvcc.exe -forward-unknown-to-host-compiler -DNUMCU_THREADS=1024 -DPY_SSIZE_T_CLEAN -Dnumcu_EXPORTS -IE:\programs\Anaconda\envs\playground\Include -IC:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\cuvec\include -IC:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\numcu\include -isystem "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include" -D_WINDOWS -Xcompiler=" /GR /EHsc" -Xcompiler="-O2 -Ob2" -DNDEBUG "--generate-code=arch=compute_86,code=[compute_86,sm_86]" -Xcompiler=-MD -MD -MT CMakeFiles\numcu.dir\src\elemwise.cu.obj -MF CMakeFiles\numcu.dir\src\elemwise.cu.obj.d -x cu -c C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\numcu\src\elemwise.cu -o CMakeFiles\numcu.dir\src\elemwise.cu.obj -Xcompiler=-FdCMakeFiles\numcu.dir\,-FS
      C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\numcu\src\elemwise.cu(13): error: identifier "FLOAT_MAX" is undefined in device code

      1 error detected in the compilation of "C:/Users/xxx/AppData/Local/Temp/pip-install-h62ogs7n/numcu_9ecc5ff6ffef44b993dd44ff8be54206/numcu/src/elemwise.cu".

      elemwise.cu

      [2/4] Building CUDA object CMakeFiles\numcu.dir\src\numcu.cu.obj
      numcu.cu

      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\skbuild\setuptools_wrap.py", line 674, in setup
          cmkr.make(make_args, install_target=cmake_install_target, env=env)
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\skbuild\cmaker.py", line 697, in make
          self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
        File "C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\skbuild\cmaker.py", line 742, in make_impl
          raise SKBuildError(msg)

      An error occurred while building with CMake.
        Command:
          'C:\Users\xxx\AppData\Local\Temp\pip-build-env-y07g4e82\overlay\Lib\site-packages\cmake\data\bin/cmake.exe' --build . --target install --config Release --
        Install target:
          install
        Source directory:
          C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206
        Working directory:
          C:\Users\xxx\AppData\Local\Temp\pip-install-h62ogs7n\numcu_9ecc5ff6ffef44b993dd44ff8be54206\_skbuild\win-amd64-3.10\cmake-build
      Please check the install target is valid and see CMake's output for more information.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for numcu
Failed to build numcu
ERROR: Could not build wheels for numcu, which is required to install pyproject.toml-based projects
casperdcl commented 10 months ago

Seems like a visual studio bug which was fixed upstream? https://devtalk.blender.org/t/cuda-compile-error-windows-10/17886