How to install pytorch from source for Asus GeForce 710 GT with CUDA CC 3.5 and supported CUDA Toolkit 11.0

How to install pytorch from source for Asus GeForce 710 GT with CUDA CC 3.5 and supported CUDA Toolkit 11.0?

The solution is that I have to build my own version from source. From Pytorch 1.3.1 on, 3.5 is not supported in the binaries anymore, they do this to reduce the size of the binary. See the comment at https://stackoverflow.com/questions/62437918/which-pytorch-version-is-cuda-3-0-compatible and https://github.com/pytorch/pytorch/issues/31285#issuecomment-565704055. That means I can well use pytorch 1.3.1 and higher with CUDA cc 3.5, I simply have to compile it myself.

And this link shows how to install pytorch from source:

I need for example MSVC 2019 to compile for CUDA CC 3.5

Main help to install from source came from:



Here are the detailed steps:

install cmake from the internet
install git from the internet
MS Visual Studio 2019 16.7.1
–> Indivudual components:

  • most recent MSVC v142 - VS 2019 C+±x64/x86-Buildtools (v14.27) (the most recent x64 version at that time)
  • most recent Windows 10 SDK (10.0.19041.0) (the most recent x64 version at that time)
    (myenv) C:\Users\Admin\Downloads\Pytorch>git clone https://github.com/pytorch/pytorch
    (myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>git submodule update --init --recursive
    (myenv) C:\Users\Admin\Downloads\Pytorch>git clone https://github.com/peterjc123/pytorch-scripts
    (Copy all files in C:\Users\Admin\Downloads\Pytorch\pytorch-scripts that are not: “\internal”, “.github”, README.md, .gitignore to C:\Users\Admin\Downloads\Pytorch\pytorch)
    conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests
    set CMAKE_GENERATOR=Visual Studio 16 2019
    # using --cmake: https://github.com/pytorch/pytorch/issues/30910, unclear if needed
    (myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>python setup.py install --cmake
    CMake Error: Error: generator : Ninja Does not match the generator used previously: Visual Studio 16 2019 Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.

if this has not worked: set USE_NINJA=OFF
(myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>python setup.py install --cmake
if this has not worked:
(myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>set DMSVC_Z7_OVERRIDE=OFF
(myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>python setup.py install --cmake
if this has not worked (according to output):
(myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>set “CUDAHOSTCXX=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\cl.exe”
(myenv) C:\Users\Admin\Downloads\Pytorch\pytorch>python setup.py install --cmake