'2020: nvcc fatal : Cannot find compiler 'cl.exe' in PATH

I'm trying to run StyleGan2 by Nvidia. I have created a new enviroment, I failed this check mandated in the readme file provided.

enter image description here

In particular, when I run it, I get the error you see in the title of the question. I looked it up, and the solution ostensibly is to add this path to env vars

C:\Program Files\Microsoft Visual Studio 10.0\VC\bin

I'm trying to do that, but I don't have bin in my VC folder! I only have include and lib, brand new installation of visual studio.



Solution 1:[1]

Thanks to @talonmies, the solution is as follows: Firstly, c++ package doesn't come by default with a clean new installation of VS, you need to select the package. Secondly, it seems that now the path for cl.exe is here

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64

Solution 2:[2]

In my case the full error message was:

nvcc fatal : Cannot find compiler 'cl.exe' in PATH

...

No CMAKE_CUDA_COMPILER could be found.

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

So I had to do:

export CUDACXX="/mnt/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.31.31103/bin/Hostx64/x64/cl.exe"

and it worked.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alex
Solution 2 Redoman