I use a K2200 for prototyping before I run my code on a compute server. Here are the steps to compile Pytorch in Anaconda:
First install gcc-4.9 g+±4.9 to compile the old Cuda dependencies
    sudo apt-get install gcc-4.9 g++-4.9

Now mostly the stuff from the pytorch website
    conda upgrade conda
    conda upgrade anaconda

    conda install numpy pyyaml mkl mkl-include setuptools cmake cffi typing
    conda install -c pytorch magma-cuda80

    git clone --recursive https://github.com/pytorch/pytorch
    cd pytorch/

    export CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"

Get the current version (3.1.0 atm)
    git checkout origin/v0.3.1

make distutils use the 4.9 compilers
    CC=gcc-4.9 CXX=g++-4.9 python setup.py install

Unfortunately I couldn’t resolve
    ldd /home/../anaconda3/lib/python3.6/site-packages/torch/_C.cpython-36m-x86_64-linux-gnu.so
    
    [....]
    libmkl_gf_lp64.so => not found
    libmkl_gnu_thread.so => not found
    libmkl_core.so => not found
    [....]

Therefore, to run pytorch code, prefix it with
    LD_LIBRARY_PATH=/home/.../anaconda3/lib64/:/home/.../anaconda3/lib/ python my_pytorch_code.py