TypeError when installing from source on windows, https://discuss.pytorch.org/

I’ve encountered problem when installing pytorch from source (the ‘master’ branch) in ‘Anaconda’ following the instruction . I’m interested in installing from source because i attempt to allow pyTorch to support my old GPU.

Can anyone help to explain why it needs to set for the ‘NVTOOLEXT_HOME’ env variable ? anything might be potentially missing in my installation steps ?

Thanks,

...
(pytorchtest) C:\myproject\python>call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.11
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.8.3
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[ERROR:vcvars.bat] Toolset directory for version '14.11' was not found.
[ERROR:VsDevCmd.bat] *** VsDevCmd.bat encountered errors. Environment may be incomplete and/or incorrect. ***
[ERROR:VsDevCmd.bat] In an uninitialized command prompt, please 'set VSCMD_DEBUG=[value]' and then re-run
[ERROR:VsDevCmd.bat] vsdevcmd.bat [args] for additional details.
[ERROR:VsDevCmd.bat] Where [value] is:
[ERROR:VsDevCmd.bat]    1 : basic debug logging
[ERROR:VsDevCmd.bat]    2 : detailed debug logging
[ERROR:VsDevCmd.bat]    3 : trace level logging. Redirection of output to a file when using this level is recommended.
[ERROR:VsDevCmd.bat] Example: set VSCMD_DEBUG=3
[ERROR:VsDevCmd.bat]          vsdevcmd.bat > vsdevcmd.trace.txt 2>&1
Building wheel torch-0.5.0a0+70d93f4
Traceback (most recent call last):
  File "C:\myproject\python\pytorch\setup.py", line 919, in <module>
    nvtoolext_lib_path = NVTOOLEXT_HOME + '/lib/x64/'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

There is a problem when installing CUDA 9.2 with VS integration. I had to deselect VS integration to finish CUDA installation. It turns out that NAVIDIA NSight is looking for ‘devenv.com’ from different path. So, it is a problem when installing Microsoft Visual Studio community 2017 edition. Reinstalling does not work. After applying the workaround [1], NVTX can be installed successfully.

However, when attempting to install from source again, it complains:

c:\program files\nvidia gpu computing toolkit\cuda\v9.2\include\crt/host_config.h(133): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported! [C:\oak-project\python\pytorch\build\caffe2\caffe2_gpu.vcxproj]

I only have VS 2017 installed and set ‘-vcvars_ver=14.15’ (by checking the actual directory in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC)

[1] https://devtalk.nvidia.com/default/topic/1016018/nsight-visual-studio-edition/nsight-installation-problem-windows-10-setup-wizard-ended-prematurely-because-of-an-error/

Build can continue by manually changing line 131 to #if _MSC_VER < 1600 || _MSC_VER > 1915

see also: https://stackoverflow.com/questions/47645436/cuda-9-unsupported-error-with-vs-2017

now, i’m stuck in compiling caffe2. It complains:

  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: "cmd.exe" exited with code 1. [C:\python\pytorch\build\caffe2\caffe2_gpu.vcxproj]

cc @peterjc123 do you have any idea?

Would you please give me the full log? This error message is not the root cause of the build failure.

I’m afraid that you are using the wrong version of VS. I have not tested VS 14.15 before but actually you can try to install 14.11. That’s the version we used in the build.