What's the difference between command installation and source code installation

freelv: <p>I’m new to pytorch. Yesterday, I installed pytorch on our server since source code. Before installation, I have to solve the problem of cuda version and cudnn version. Previously, our server’s cuda version is 8.0, while cudnn version is 5.1. So that the latest pytorch cannot be installed successfully, it needs cudnn version to be above than 6.0. However, some of my classmates installed pytotch on the same machine(cuda 8.0 and cudnn 5.0) with command pip successfully. From the command   It seems that pip command does not pay attention to cuda and cudnn version. I don’t know whether can we install pytorch successfully through conda command line.<br>
So can anyone tell me what the difference between command installation and source code installation? Does  command line just pay attention to cuda version and ignore cudnn version? Thank you.</p>

ptrblck: <p>The conda and pip binaries come with built-in libs. See this answer from another thread:</p>
<aside class="quote" data-post="3" data-topic="698">
  <div class="title">
    <div class="quote-controls"></div>
    <img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/smth/48/13_2.png" class="avatar">
    <a href="https://discuss.pytorch.org/t/newbie-question-what-are-the-prerequisites-for-running-pytorch-with-gpu/698/3">Newbie question: What are the prerequisites for running PyTorch with GPU?</a> 
  </div>
  <blockquote>
    if you want to use pytorch with an NVIDIA GPU, all you need to do is install pytorch binaries and start using it. We ship with everything in-built (pytorch binaries include CUDA, CuDNN, NCCL, MKL, etc.). 
So it’s a one-touch install: 

Install pytorch from binaries ( <a href="http://pytorch.org">http://pytorch.org</a> has instructions)
Try a simple program with CUDA:

import torch
a = torch.randn(10).cuda()
print(a)
print(a + 2)
  </blockquote>
</aside>

<p>Usually you don’t need to build it from source.<br>
The reasons why you would want to build it yourself are:</p>
<ul>
<li>if you would like to develop a new PyTorch feature and thus need to work on the source code</li>
<li>if you need a new PyTorch feature or bug fix which has not been integrated into the binaries yet.</li>
</ul>

freelv: <p>Thank you for your reply.</p>
<aside class="quote no-group" data-username="ngimel" data-post="2" data-topic="7231" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ngimel/48/14766_2.png" class="avatar"><a href="https://discuss.pytorch.org/t/built-in-cuda-not-working/7231/2">Built-in CUDA not working?</a></div>
<blockquote>
<p>Pytorch comes with its own runtime cuda libraries, but driver has to be installed on each machine separately</p>
</blockquote>
</aside>
<p>I saw this reply, and I tried installing pytorch with command, it will download cudnn library(7.1). Does it mean pytorch has nothing to do with system cudnn version, and run its own cudnn?</p>

ptrblck: <p>If you build it from source, the script will try to find your CuDNN installation.<br>
You can see some information in the terminal while building, e.g. which libs were found and which are missing.</p>

jonathanking: <p>I’ve heard of users getting a large speed-up when building from source compared to using a pre-built binary. Is that expected?</p>

ptrblck: <p>It depends on the local installation of various libs.<br>
E.g. the binaries ship with CUDA, cudnn, mkl-dnn etc.<br>
If you don’t have cudnn or mkl locally installed, you would see a slowdown.<br>
However, you the latest versions of these libs might give you a speedup, so you could compare the binaries against your build from source.</p>

kandarp_sharda: <p>can I install pytorch through source code that support cuda binaries like we do with pip install?</p>

ptrblck: <p>Yes and you can find the build scripts in the <a href="https://github.com/pytorch/builder"><code>pytorch/builder</code></a> repository.</p>

kandarp_sharda: <p>I tried to create build wheel file by putting this env variable<br>
ENV PYTORCH_BUILD_VERSION=1.8.1<br>
ENV PYTORCH_BUILD_NUMBER=1<br>
ENV CMAKE_PREFIX_PATH=“$(dirname $(which conda))/…/”<br>
ENV TORCH_NVCC_FLAGS=“-Xfatbin -compress-all”<br>
ENV TH_BINARY_BUILD=1<br>
ENV USE_STATIC_CUDNN=1<br>
ENV USE_STATIC_NCCL=1<br>
<span class="hashtag-raw">#ENV</span> ATEN_STATIC_CUDA=1<br>
ENV USE_CUDA_STATIC_LINK=1<br>
ENV NCCL_ROOT_DIR=/usr/local/cuda<br>
ENV TORCH_CUDA_ARCH_LIST=“7.5”<br>
ENV INSTALL_TEST=0</p>
<p>after  building this file I try to install this on another system which doesn’t  have CUDA installed but have GPU driver support , it is throwing me some error after I try to import torch that some “xyz file is not readable as it does not exist”  then I tried to find out which file is missing , that “xyz file” is part of CUDA toolkit , why does it required CUDA after we have set this env USE_CUDA_STATIC_LINK=1  during wheel creation ?</p>