Issues with tutorial "Installing C++ Distributions of PyTorch"

username: Clem_Grt
cooked: <p>Good evening everybody,</p>
<p>I’m new to PyTorch and CMake and desperately trying to carry out the tutorial “Installing C++ Distributions of PyTorch”. It has been now 6 hours i’ve been solving problems one after the other.</p>
<p>Now, I’m trying to execute these commands :</p>
<p>"We can now run the following commands to build the application from within the <code>example-app/</code> folder:</p>
<p>mkdir build<br>
cd build<br>
cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch …<br>
make<br>
"<br>
First, it took me many hours to solve issues with cmake but the right command i had to write is <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=6" title=":slight_smile:" class="emoji" alt=":slight_smile:"><br>
“cmake -DCMAKE_PREFIX_PATH=…/libtorch … -Ax64 - DCMAKE_BUILD_TYPE=Debug”<br>
And it finally seems to work fine<br>
but then when I try<br>
“make”<br>
I just get an error message saying “No target specified and no makefile found. Stopped.”</p>
<p>What am I missing ?</p>

username: ptrblck
cooked: <p>Are you sure the three dots after your path to libtorch are right?<br>
What kind of error messages did you get before changing the <code>cmake</code> command?</p>

username: Clem_Grt
cooked: <p>You are right, there are only two dots (what is their role by the way ?) (edit: the third one seems to have been added by the forum since there are only two in my text)</p>
<p>Here are the error message when using the basic command line <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=6" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>
<p>CMake Error at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/public/cuda.cmake:283 (message):<br>
CUDA support not available with 32-bit windows.  Did you forget to set<br>
Win64 in the generator target?<br>
Call Stack (most recent call first):<br>
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)<br>
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)<br>
CMakeLists.txt:3 (find_package)</p>

username: ptrblck
cooked: <p>The two dots specify the path of your <code>CMakeLists.txt</code> to the parent directory.</p>
<p>I’m not really familiar with Windows, but could you try to add  <code>-DCMAKE_GENERATOR_PLATFORM=x64</code> to your <code>cmake</code> command?</p>

username: Clem_Grt
cooked: <p>You are right, I should have guessed it for the dots.<br>
Thanks a lot for your answer, i’ll try that at once.</p>

username: Clem_Grt
cooked: <p>It seems to work as well as -Ax64 yet I still have this warning message <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=6" title=":slight_smile:" class="emoji" alt=":slight_smile:">-- Added CUDA NVCC flags for: -gencode;arch=compute_50,code=sm_50<br>
CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/public/utils.cmake:57 (if):<br>
Policy CMP0054 is not set: Only interpret if() arguments as variables or<br>
keywords when unquoted.  Run “cmake --help-policy CMP0054” for policy<br>
details.  Use the cmake_policy command to set the policy and suppress this<br>
warning.</p>
<p>Quoted variables like “MSVC” will no longer be dereferenced when the policy<br>
is set to NEW.  Since the policy is not set the OLD behavior will be used.<br>
Call Stack (most recent call first):<br>
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:121 (caffe2_interface_library)<br>
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)<br>
CMakeLists.txt:3 (find_package)<br>
This warning is for project developers.  Use -Wno-dev to suppress it.</p>
<p>CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:72 (if):<br>
Policy CMP0054 is not set: Only interpret if() arguments as variables or<br>
keywords when unquoted.  Run “cmake --help-policy CMP0054” for policy<br>
details.  Use the cmake_policy command to set the policy and suppress this<br>
warning.</p>
<p>Quoted variables like “MSVC” will no longer be dereferenced when the policy<br>
is set to NEW.  Since the policy is not set the OLD behavior will be used.<br>
Call Stack (most recent call first):<br>
CMakeLists.txt:3 (find_package)<br>
This warning is for project developers.  Use -Wno-dev to suppress it.</p>
<p>Anyway, the “make” command still doesn’t find anything afterward…</p>
<p>Thanks again  for your interest</p>

username: Clem_Grt
cooked: <p>Following the Tutorial from the beginning still doesn’t work.<br>
“cmake” command seems to not generate the required files since make can’t find any. Yet I stick to the tutorial…</p>
<p>Here is the result of the cmake command if someone can help me…<br>
– Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.<br>
– Caffe2: CUDA detected: 10.0<br>
– Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin/nvcc.exe<br>
– Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0<br>
– Caffe2: Header version is: 10.0<br>
– Found cuDNN: v7.4.2  (include: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/include, library: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64/cudnn.lib)<br>
– Autodetected CUDA architecture(s): 5.0<br>
– Added CUDA NVCC flags for: -gencode;arch=compute_50,code=sm_50<br>
CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/public/utils.cmake:57 (if):<br>
Policy CMP0054 is not set: Only interpret if() arguments as variables or<br>
keywords when unquoted.  Run “cmake --help-policy CMP0054” for policy<br>
details.  Use the cmake_policy command to set the policy and suppress this<br>
warning.</p>
<p>Quoted variables like “MSVC” will no longer be dereferenced when the policy<br>
is set to NEW.  Since the policy is not set the OLD behavior will be used.<br>
Call Stack (most recent call first):<br>
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:121 (caffe2_interface_library)<br>
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)<br>
CMakeLists.txt:3 (find_package)<br>
This warning is for project developers.  Use -Wno-dev to suppress it.</p>
<p>CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:72 (if):<br>
Policy CMP0054 is not set: Only interpret if() arguments as variables or<br>
keywords when unquoted.  Run “cmake --help-policy CMP0054” for policy<br>
details.  Use the cmake_policy command to set the policy and suppress this<br>
warning.</p>
<p>Quoted variables like “MSVC” will no longer be dereferenced when the policy<br>
is set to NEW.  Since the policy is not set the OLD behavior will be used.<br>
Call Stack (most recent call first):<br>
CMakeLists.txt:3 (find_package)<br>
This warning is for project developers.  Use -Wno-dev to suppress it.</p>
<p>– Configuring done<br>
– Generating done<br>
– Build files have been written to: C:/Users/Clément/Documents/Visual Studio 2017/Projects/PyTorchTest/build</p>

username: Navneet_M_Kumar
cooked: <p>I am also facing the same issues. make does not find the required files.</p>

username: Fariha1123
cooked: <p>hey did u manage to solve it?</p>

username: Clem_Grt
cooked: <p>Sorry for the late answer but, no, I didn’t and gave it up. I’m back to Python… for now</p>

username: erict
cooked: <p>Hi,</p>
<p>maybe is not what you are looking for but for compiling on windows you can use this command cmake --build . --config Release to create .exe with torchlib inside build folder after cmake command.</p>

username: kirtaa
cooked: <p>Hi,</p>
<p>I’m also facing problems when trying to follow the tutorial, however, in my case cmake is able to find all the required files.</p>
<p>I have followed the tutorial from point to point, althought, I had to add this to be able to generate for x64.</p>
<blockquote>
<p>cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch …</p>
</blockquote>
<p>My issue is that when running “cmake --build . -config Release”, I am prompted with the following error:</p>
<blockquote>
<p>C:\bd\Features\PyTorch\libtorch\include\c10/util/variant.h(1187): error C2872: ‘std’: ambiguous symbol [C:\bd\Features<br>
PyTorch\example-app\build\example-app.vcxproj]<br>
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\forward_list(15): note: could be ‘std’<br>
C:\bd\Features\PyTorch\libtorch\include\c10/util/variant.h(1187): note: or       ‘std’<br>
C:\bd\Features\PyTorch\libtorch\include\c10/util/variant.h(1401): note: see reference to class template instantiation</p>
</blockquote>
<p>Does anyone know what is causing this error? I would appreciate any help as I’m completely new to both PyTorch and cmake.</p>