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

Running into Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found version "12.6") Error with CUDA 12.6 #56

Closed
1 task done
q10 opened this issue Dec 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@q10
Copy link

q10 commented Dec 14, 2024

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

We are trying to build FBGEMM against the CUDA 12.6 (pytorch/FBGEMM#3503), and are running into the following error:

-- Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found version "12.6")
CMake Warning at /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:31 (message):
  PyTorch: CUDA cannot be found.  Depending on whether you are building
  PyTorch or a PyTorch dependent library, the next warning / error will give
  you more info.
Call Stack (most recent call first):
  /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
  /github/home/miniconda/envs/build_binary/lib/python3.13/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
  /__w/FBGEMM/FBGEMM/cmake/modules/PyTorchSetup.cmake:14 (find_package)
  CMakeLists.txt:78 (include)

For some context:

All of our builds and tests are performed inside a Conda environment, and all of the tool chains and dependencies that we use (gcc, clang, torch, CUDA) are installed from scratch using conda install, for maximum environment isolation and build reproducibility. We have been successfully building FBGEMM against CUDA 11.7, 11.8, 12.1, and 12.4 for a while now, and have been able to rigorously document the full build process here.

We usually install the full CUDA metapackage, i.e.

conda install --force-reinstall -n build_env -c "nvidia/label/cuda-12.6.3" -y cuda

We did notice that for CUDA 12.6, when we look for cuda.h, we see:

(build_env) bash-5.2# find / -name cuda.h
/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/targets/x86_64-linux/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev_linux-64-12.6.77-0/targets/x86_64-linux/include/cuda.h

whereas with CUDA 12.4, we have:

/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/include/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev-12.4.127-0/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h

and with CUDA 11.8, we have:

(base) bash-5.2# find / -name cuda.h
/root/miniconda/envs/build_env/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h
/root/miniconda/envs/build_env/include/cuda.h
/root/miniconda/pkgs/cuda-cudart-dev-11.8.89-0/include/cuda.h
/root/miniconda/pkgs/kernel-headers_linux-64-3.10.0-he073ed8_18/x86_64-conda-linux-gnu/sysroot/usr/include/linux/cuda.h

In other words, the CUDA headers do not appear to be installed onto $CONDA_PREFIX/include. It seems to me at least that conda install process for CUDA 12.6 is incorrect, or has been updated in a way that CMake is unable to find the path.

My questions are:

  1. Is this behavior (e.g. migrating CUDA headers from $CONDA_PREFIX/include to $CONDA_PREFIX/targets/x86_64-linux/include) expected?
  2. If so, what value do we set CUDA_INCLUDE_DIRS and/or CUDA_TOOLKIT_ROOT_DIR? I've read from here and here that we should manually set CUDA_TOOLKIT_ROOT_DIR, but those apply to non-Conda installations of CUDA, where everything is in one directory.

Installed packages

(build_env) bash-5.2# conda list
# packages in environment at /root/miniconda/envs/build_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
alsa-lib                  1.2.13               hb9d3cd8_0    conda-forge
attrs                     24.2.0             pyh71513ae_1    conda-forge
bazel                     7.3.2                h7df20bc_1    conda-forge
binutils_impl_linux-64    2.40                 h5293946_0  
binutils_linux-64         2.40                 hb3c18ed_4    conda-forge
build                     1.2.2.post1              pypi_0    pypi
bzip2                     1.0.8                h5eee18b_6  
c-ares                    1.34.3               hb9d3cd8_1    conda-forge
ca-certificates           2024.11.26           h06a4308_0  
cairo                     1.18.0               hbb29018_2    conda-forge
cffi                      1.17.1                   pypi_0    pypi
clang                     16.0.6          default_h9e3a008_13    conda-forge
clang-16                  16.0.6          default_hb5137d0_13    conda-forge
clangxx                   16.0.6          default_ha78316a_13    conda-forge
click                     8.1.7           unix_pyh707e725_1    conda-forge
cmake                     3.31.2               h74e3db0_1    conda-forge
compiler-rt               16.0.6               h00ab1b0_2    conda-forge
compiler-rt_linux-64      16.0.6               h00ab1b0_2    conda-forge
cryptography              44.0.0                   pypi_0    pypi
cuda                      12.6.3                        0    nvidia/label/cuda-12.6.3
cuda-cccl_linux-64        12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-command-line-tools   12.6.3                        0    nvidia/label/cuda-12.6.3
cuda-compiler             12.6.3                        0    nvidia/label/cuda-12.6.3
cuda-crt-dev_linux-64     12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-crt-tools            12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-cudart               12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cudart-dev           12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cudart-dev_linux-64  12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cudart-static        12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cudart-static_linux-64 12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cudart_linux-64      12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cuobjdump            12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-cupti                12.6.80                       0    nvidia/label/cuda-12.6.3
cuda-cupti-dev            12.6.80                       0    nvidia/label/cuda-12.6.3
cuda-cuxxfilt             12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-driver-dev           12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-driver-dev_linux-64  12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-gdb                  12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-libraries            12.6.3               ha770c72_0    conda-forge
cuda-libraries-dev        12.6.3               ha770c72_0    conda-forge
cuda-nsight               12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-nvcc                 12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvcc-dev_linux-64    12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvcc-impl            12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvcc-tools           12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvcc_linux-64        12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvdisasm             12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-nvml-dev             12.6.77                       2    nvidia/label/cuda-12.6.3
cuda-nvprof               12.6.80                       0    nvidia/label/cuda-12.6.3
cuda-nvprune              12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-nvrtc                12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvrtc-dev            12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvtx                 12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-nvvm-dev_linux-64    12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvvm-impl            12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvvm-tools           12.6.85                       0    nvidia/label/cuda-12.6.3
cuda-nvvp                 12.6.80                       0    nvidia/label/cuda-12.6.3
cuda-opencl               12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-opencl-dev           12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-profiler-api         12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-runtime              12.6.3                        0    nvidia/label/cuda-12.6.3
cuda-sanitizer-api        12.6.77                       0    nvidia/label/cuda-12.6.3
cuda-toolkit              12.6.3                        0    nvidia/label/cuda-12.6.3
cuda-tools                12.6.3                        0    nvidia/label/cuda-12.6.3
cuda-version              12.6                          3    nvidia/label/cuda-12.6.3
cuda-visual-tools         12.6.3                        0    nvidia/label/cuda-12.6.3
dbus                      1.13.18              hb2f20db_0  
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_1    conda-forge
expat                     2.6.4                h6a678d5_0  
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 h77eed37_3    conda-forge
fontconfig                2.15.0               h7e30c49_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
gcc_impl_linux-64         11.4.0              h00c12a0_13    conda-forge
gcc_linux-64              11.4.0               ha077dfb_4    conda-forge
gds-tools                 1.11.1.6                      0    nvidia/label/cuda-12.6.3
giflib                    5.2.2                hd590300_0    conda-forge
glib                      2.82.2               h44428e9_0    conda-forge
glib-tools                2.82.2               h4833e2c_0    conda-forge
gmp                       6.2.1                h295c915_3  
graphite2                 1.3.13            h59595ed_1003    conda-forge
gxx_impl_linux-64         11.4.0              h634f3ee_13    conda-forge
gxx_linux-64              11.4.0               h35bfe5d_4    conda-forge
harfbuzz                  9.0.0                hfac3d4d_0    conda-forge
hypothesis                6.122.3            pyha770c72_0    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
ijar                      7.3.2                h5888daf_0    conda-forge
jinja2                    3.1.4              pyhd8ed1ab_1    conda-forge
kernel-headers_linux-64   3.10.0              he073ed8_18    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.21.3               h659f571_0    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.40                 h12ee557_0  
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20240722.0      cxx17_h5888daf_1    conda-forge
libclang-cpp16            16.0.6          default_hb5137d0_13    conda-forge
libcublas                 12.6.4.1                      0    nvidia/label/cuda-12.6.3
libcublas-dev             12.6.4.1                      0    nvidia/label/cuda-12.6.3
libcufft                  11.3.0.4                      0    nvidia/label/cuda-12.6.3
libcufft-dev              11.3.0.4                      0    nvidia/label/cuda-12.6.3
libcufile                 1.11.1.6                      0    nvidia/label/cuda-12.6.3
libcufile-dev             1.11.1.6                      0    nvidia/label/cuda-12.6.3
libcups                   2.3.3                h4637d8d_4    conda-forge
libcurand                 10.3.7.77                     0    nvidia/label/cuda-12.6.3
libcurand-dev             10.3.7.77                     0    nvidia/label/cuda-12.6.3
libcurl                   8.11.1               h332b0f4_0    conda-forge
libcusolver               11.7.1.2                      0    nvidia/label/cuda-12.6.3
libcusolver-dev           11.7.1.2                      0    nvidia/label/cuda-12.6.3
libcusparse               12.5.4.2                      0    nvidia/label/cuda-12.6.3
libcusparse-dev           12.5.4.2                      0    nvidia/label/cuda-12.6.3
libcxx                    19.1.5               hb37ccd0_0    conda-forge
libcxxabi                 19.1.5               h108a707_0    conda-forge
libdeflate                1.22                 hb9d3cd8_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libexpat                  2.6.4                h5888daf_0    conda-forge
libffi                    3.4.4                h6a678d5_1  
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-devel_linux-64     11.4.0             h8f596e0_113    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libgfortran               14.2.0               h69a702a_1    conda-forge
libgfortran5              14.2.0               hd5240d6_1    conda-forge
libglib                   2.82.2               h2ff4ddf_0    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libgrpc                   1.67.1               hc2c308b_0    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
libllvm16                 16.0.6               hb3ce162_3    conda-forge
liblzma                   5.6.3                hb9d3cd8_1    conda-forge
libmpdec                  4.0.0                h5eee18b_0  
libnghttp2                1.64.0               h161d5f1_0    conda-forge
libnpp                    12.3.1.54            h5888daf_0    conda-forge
libnpp-dev                12.3.1.54            h5888daf_0    conda-forge
libnvfatbin               12.6.77                       0    nvidia/label/cuda-12.6.3
libnvfatbin-dev           12.6.77                       0    nvidia/label/cuda-12.6.3
libnvjitlink              12.6.85                       0    nvidia/label/cuda-12.6.3
libnvjitlink-dev          12.6.85                       0    nvidia/label/cuda-12.6.3
libnvjpeg                 12.3.3.54            h5888daf_0    conda-forge
libnvjpeg-dev             12.3.3.54            ha770c72_0    conda-forge
libopenblas               0.3.28          pthreads_h94d23a6_1    conda-forge
libpng                    1.6.44               hadc24fc_0    conda-forge
libprotobuf               5.28.2               h5b01275_0    conda-forge
libre2-11                 2024.07.02           hbbce691_1    conda-forge
libsanitizer              11.4.0              h5763a12_13    conda-forge
libsqlite                 3.47.2               hee588c1_0    conda-forge
libssh2                   1.11.1               hf672d98_0    conda-forge
libstdcxx                 14.2.0               hc0a3c3a_1    conda-forge
libstdcxx-devel_linux-64  11.4.0             h8f596e0_113    conda-forge
libstdcxx-ng              14.2.0               h4852527_1    conda-forge
libtiff                   4.7.0                hc4654cb_2    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.49.2               hb9d3cd8_0    conda-forge
libwebp-base              1.4.0                hd590300_0    conda-forge
libxcb                    1.17.0               h8a09558_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxkbcommon              1.7.0                h2c5496b_1    conda-forge
libxml2                   2.12.7               hc051c1a_1    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
llvm-openmp               16.0.6               h4dfa4b3_0    conda-forge
make                      4.4.1                hb9d3cd8_2    conda-forge
markupsafe                3.0.2           py313h8060acc_1    conda-forge
ncurses                   6.5                  he02047a_1    conda-forge
ninja                     1.12.1               h297d8ca_0    conda-forge
nsight-compute            2024.3.2.3                    0    nvidia/label/cuda-12.6.3
nspr                      4.35                 h6a678d5_0  
nss                       3.105                hd34e28f_0    conda-forge
openblas                  0.3.28          pthreads_h6ec200e_1    conda-forge
openjdk                   23.0.1               h4c11d01_0    conda-forge
openssl                   3.4.0                hb9d3cd8_0    conda-forge
packaging                 24.2               pyhd8ed1ab_2    conda-forge
patchelf                  0.17.2               h58526e2_0    conda-forge
pcre2                     10.44                hba22ea6_2    conda-forge
pip                       24.3.1                   pypi_0    pypi
pixman                    0.44.2               h29eaf8c_0    conda-forge
pthread-stubs             0.4               hb9d3cd8_1002    conda-forge
pycparser                 2.22                     pypi_0    pypi
pyopenssl                 24.3.0                   pypi_0    pypi
pyproject-hooks           1.2.0                    pypi_0    pypi
python                    3.13.1          ha99a958_102_cp313    conda-forge
python_abi                3.13                    0_cp313  
re2                       2024.07.02           h77b4e00_1    conda-forge
readline                  8.2                  h5eee18b_0  
rhash                     1.4.5                hb9d3cd8_0    conda-forge
scikit-build              0.18.1             pyh4afc917_0    conda-forge
setuptools                75.1.0          py313h06a4308_0  
singlejar                 7.3.2                h5c8f2c3_1    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sqlite                    3.47.2               h9eae976_0    conda-forge
sysroot_linux-64          2.17                h4a8ded7_18    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.2.1              pyhd8ed1ab_1    conda-forge
typing-extensions         4.12.2               hd8ed1ab_1    conda-forge
typing_extensions         4.12.2             pyha770c72_1    conda-forge
tzdata                    2024b                h04d1e81_0  
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
xkeyboard-config          2.43                 hb9d3cd8_0    conda-forge
xorg-libice               1.1.1                hb9d3cd8_1    conda-forge
xorg-libsm                1.2.4                he73a12e_1    conda-forge
xorg-libx11               1.8.10               h4f16b4b_1    conda-forge
xorg-libxau               1.0.11               hb9d3cd8_1    conda-forge
xorg-libxdmcp             1.1.5                hb9d3cd8_0    conda-forge
xorg-libxext              1.3.6                hb9d3cd8_0    conda-forge
xorg-libxfixes            6.0.1                hb9d3cd8_0    conda-forge
xorg-libxi                1.8.2                hb9d3cd8_0    conda-forge
xorg-libxrandr            1.5.4                hb9d3cd8_0    conda-forge
xorg-libxrender           0.9.11               hb9d3cd8_2    conda-forge
xorg-libxt                1.3.1                hb9d3cd8_0    conda-forge
xorg-libxtst              1.2.5                hb9d3cd8_3    conda-forge
xz                        5.4.6                h5eee18b_1  
zlib                      1.3.1                hb9d3cd8_2    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge
(build_env) bash-5.2#

Environment info

(build_env) bash-5.2# conda info

     active environment : build_env
    active env location : /root/miniconda/envs/build_env
            shell level : 2
       user config file : /root/.condarc
 populated config files : /root/miniconda/.condarc
          conda version : 24.11.1
    conda-build version : not installed
         python version : 3.12.8.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=24.11.1=0
                          __glibc=2.34=0
                          __linux=5.15.49=0
                          __unix=0=0
       base environment : /root/miniconda  (writable)
      conda av data dir : /root/miniconda/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /root/miniconda/pkgs
                          /root/.conda/pkgs
       envs directories : /root/miniconda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/24.11.1 requests/2.32.3 CPython/3.12.8 Linux/5.15.49-linuxkit amzn/2023.6.20241121 glibc/2.34 solver/libmamba conda-libmamba-solver/24.9.0 libmambapy/1.5.11 aau/0.4.4 c/y9hCWxGMVafoJzXeH0wkog s/kQYdsacincQ_QGd77ljlgQ e/vkuBvTVNMhBRt74NJNj-rA
                UID:GID : 0:0
             netrc file : None
           offline mode : False

(build_env) bash-5.2# nvcc --version
nvcc warning : incompatible redefinition for option 'compiler-bindir', the last value of this option was used
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Oct_29_23:50:19_PDT_2024
Cuda compilation tools, release 12.6, V12.6.85
Build cuda_12.6.r12.6/compiler.35059454_0
(build_env) bash-5.2#
@q10 q10 added the bug Something isn't working label Dec 14, 2024
@jakirkham
Copy link
Member

Please try again with all packages coming from just conda-forge. If you still see an issue with that, please report that as a new issue with the information requested

Mixing channels in this way is unsupported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants