Hi everyone!
I have been trying to install Pytorch for over a week now, and I can not get it to work. After approximately 8 hours, the build always stops with:
Making of project "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\xla_tensor_test.vcxproj" is finished (Standardziele).
Making of project "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\ALL_BUILD.vcxproj" is finished (Standardziele) -- ERROR.
Making of project "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\install.vcxproj" is finished (Standardziele) -- ERROR.
Error in build process.
Then I get a bunch of similar warnings like:
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\install.vcxproj" (Standardziel) (1) ->
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\ALL_BUILD.vcxproj" (Standardziel) (3) ->
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\proto\Caffe2_PROTO.vcxproj" (Standardziel) (4) ->
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\third_party\protobuf\cmake\protoc.vcxproj" (Standardziel) (5) ->
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\third_party\protobuf\cmake\libprotobuf.vcxproj" (Standardziel) (6) ->
(ClCompile Ziel) ->
cl : Command line warning D9025 : overriding “/W1” with “/w” [C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\third_party\protobuf\cmake\libprotobuf.vcxproj]
And finally:
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\install.vcxproj" (Standardziel) (1) ->
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\ALL_BUILD.vcxproj" (Standardziel) (3) ->
"C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\cuda_atomic_ops_test.vcxproj" (Standardziel) (132) ->
(Link Ziel) ->
cuda_atomic_ops_test_generated_cuda_atomic_ops_test.cu.obj : error LNK2019: unresolved external symbol ""float __cdecl pow(float,int)" (?pow@@YAMMH@Z)" in function ""void __cdecl test_atomic_mul<float>(void)" (?
?$test_atomic_mul@M@@YAXXZ)". [C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\cuda_atomic_ops_test.vcxp
roj]
cuda_atomic_ops_test_generated_cuda_atomic_ops_test.cu.obj : error LNK2019: unresolved external symbol ""double __cdecl pow(double,int)" (?pow@@YANNH@Z)" in function ""void __cdecl test_atomic_mul<double>(void)"
(??$test_atomic_mul@N@@YAXXZ)". [C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\cuda_atomic_ops_test.v
cxproj]
C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\bin\Release\cuda_atomic_ops_test.exe : fatal error LNK1120: 2
unresolved externals [C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\build\caffe2\cuda_atomic_ops_test.vcxproj]
473 Warnings
3 Errors
Passed Time 08:08:32.28
Traceback (most recent call last):
File "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\setup.py", line 717, in <module>
build_deps()
File "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\setup.py", line 308, in build_deps
build_caffe2(version=version,
File "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\tools\build_pytorch_libs.py", line 62, in build_caffe2
cmake.build(my_env)
File "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\tools\setup_helpers\cmake.py", line 345, in build
self.run(build_args, my_env)
File "C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\tools\setup_helpers\cmake.py", line 141, in run
check_call(command, cwd=self.build_dir, env=env)
File "C:\Users\gooog\anaconda3\envs\torchbuild\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '/p:CL_MPCount=1']' returned non-zero exit status 1.
I translated some german parts, so don’t be confused if something sounds off. I did not know, how (Standartziel)
is called in english, but it basically means “default target”. I hope, everything else is understandable.
Some general information on my setup:
- Windows 10 (64 bit)
- GPU: Nvidia GeForce 920M (Computing Capability = 3.5)
- Driver Version: 426.00 (latest)
- Visual Studio 2019 16.9.4 (Community)
- CUDA 10.1.243
- CuDNN 8.0.5
This is how I install:
cd C:\Users\gooog\Downloads
mkdir Pytorch
cd Pytorch
conda create --name torchbuild
y
conda activate torchbuild
conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses
y
conda install -c conda-forge libuv=1.39
y
git clone --branch v1.7.0 https://github.com/pytorch/pytorch.git pytorch-1.7.0
cd pytorch-1.7.0
git clean -xdfcond
python setup.py clean
git submodule deinit -f --all
git submodule sync --recursive
git submodule update --init --recursive
At this point, I manually change two things in the source code in order to fix some bugs I encountered earlier:
-
Adding
const
to C:\Users\gooog\Downloads\Pytorch\pytorch-1.7.0\aten\src\ATen\native\CompositeRandomAccessorCommon.h according to:
Visual Studio Feedback -
Adding a few lines to C:\Users\gooog\Downloads\Pytorch
\pytorch-1.7.0\cmake\public\cuda.cmake according to:
[test] alternative fix for vc 16.8 with nvcc by peterjc123 · Pull Request #54391 · pytorch/pytorch · GitHub
Then I continue installing:
set TMP_DIR_WIN=C:\Users\gooog\Downloads
C:/Users/gooog/Downloads/Use_mkl.bat
C:/Users/gooog/Downloads/Use_sccache.bat
set USE_NINJA=OFF
set CMAKE_VERBOSE_MAKEFILE=1
set CMAKE_GENERATOR=Visual Studio 16 2019
set CMAKE_GENERATOR_TOOLSET_VERSION=14.28
set DISTUTILS_USE_SDK=1
set PATH=%TMP_DIR_WIN%\bin;%PATH%
sccache --stop-server
sccache --start-server
sccache --zero-stats
set CC=sccache-cl
set CXX=sccache-cl
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%
set CUDAHOSTCXX=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe
set MAX_JOBS=1
python setup.py build --cmake
python setup.py install
Use_mkl.bat and Use_sccache.bat were copied from pytorch/.jenkins/pytorch/win-test-helpers/installation-helpers at master · pytorch/pytorch · GitHub
Since the files were rather long, I uploaded:
- CMakeError.log: CMakeError.log - JustPaste.it
- CMakeOutput.log: CMakeOutput.log - JustPaste.it
This is the first time I try to install something from source, so please excuse some (probably) strange steps, like manually changing the source files .
I need pytorch for my thesis, so any help would be very very much appreciated. Also let me know, if you need anything else.
Many thanks in advance!