Installing pytorch from the source using pip

username: Rishav_Sapahia
cooked: <p>Hi,<br>
I am trying to install pytorch on a remote server with <code>CentOS 6.5</code>.According to the pytorch, it has stopped binary support for  <code>CentOS 6</code> , so I am trying to install it via source. But the method they have mentioned use <code>conda</code> to use it but I want to install it via pip because I don’t have sudo access so there are plenty of path errors creeping up while installing via <code>conda</code>.<br>
I am struck at below lines -</p>
<p><code>conda install -c pytorch magma-cuda90</code><br>
The above command is mentioned before the pytorch cloning step and it given me an error that<br>
<code>Could not open requirements file: [Errno 2] No such file or directory: 'pytorch'</code></p>
<p>The other issue I am facing is below-<br>
<code>export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}</code>  Wht should be the alternative for  <code>CMAKE_PREFIX_PATH</code>  in pip?</p>

username: ptrblck
cooked: <p>If I’m not mistaken, the mentioned <code>CMAKE_PREFIX_PATH</code> makes sure to use the current conda environment, so if you are fine with a system wide installation, you could probably skip this step.<br>
In the pytorch directory, you could run <code>pip install -v .</code> to install pytorch via pip.<br>
(Note the last dot in the command! <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=9" title=":wink:" class="emoji" alt=":wink:"> )</p>

username: Rishav_Sapahia
cooked: <p>Now, I am getting</p>
<blockquote>
<p>CMake Error: The current CMakeCache.txt directory /tmp/pip-trgmgbq3-build/build/CMakeCache.txt is different than the directory /nethome/rxs1576/pytorch/build where CMackeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt</p>
</blockquote>
<p>And Extra information - CMake is already installed in the server but I haven’t loaded it for my work.</p>

username: ptrblck
cooked: <p>Could you try to remove the <code>CMakeCache.txt</code> and try it again?</p>

username: Rishav_Sapahia
cooked: <p>Yes,<br>
deleting the<code>CMakeCache.txt</code> worked but then I got myriads of other errors which were just becoming too much overwhelming then I tried hard to install <code>conda</code> which worked eventually but now I am not able to install pytorch via source using conda <img src="https://discuss.pytorch.org/images/emoji/apple/neutral_face.png?v=9" title=":neutral_face:" class="emoji" alt=":neutral_face:"><img src="https://discuss.pytorch.org/images/emoji/apple/sleepy.png?v=9" title=":sleepy:" class="emoji" alt=":sleepy:"></p>

username: ptrblck
cooked: <p>What error message are you getting using conda?</p>

username: Rishav_Sapahia
cooked: <p>Below is the log after building from source-</p>
<pre><code class="lang-auto">Linking    libnccl.so.2.4.8                    &gt; /nethome/rxs1576/pytorch/build/nccl/lib/libnccl.so.2.4.8
make: *** [src.build] Segmentation fault (core dumped)
[618/3273] Building CXX object third_party/ideep/mkl-dnn/src/CMakeFiles/mkldnn.dir/cpu/rnn/ref_rnn.cpp.o
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "setup.py", line 751, in &lt;module&gt;
    build_deps()
  File "setup.py", line 310, in build_deps
    cmake=cmake)
  File "/nethome/rxs1576/pytorch/tools/build_pytorch_libs.py", line 59, in build_caffe2
    cmake.build(my_env)
  File "/nethome/rxs1576/pytorch/tools/setup_helpers/cmake.py", line 334, in build
    self.run(build_args, my_env)
  File "/nethome/rxs1576/pytorch/tools/setup_helpers/cmake.py", line 142, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/nethome/rxs1576/anaconda3/envs/conda36/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '16']' returned non-zero exit status 1.

</code></pre>

username: Rishav_Sapahia
cooked: <p>There is also an approach which I though should work to resolve it but having issues while implementing it too(Pasting from Stack Overlfow)-<br>
I am trying to install Pytorch in a remote server with no root privileges.<br>
I want to install <code>Cuda 10</code> on it. I have installed <code>conda</code> environment on it already.<br>
Remote server has already few <code>cuda</code> versions like <code>cuda9.1</code> and older than it.<br><br>
After installing <code>cudatoolkit:10.1.168</code> in the conda environment, I don’t know how to use this cuda in place of already present in the remote machine.<br><br>
It use by default the already installed cuda versions by the system(9.1 in this case).<br><br>
I had the same issue regarding using the <code>python</code> of <code>conda</code> which I resolved using <br></p>
<pre><code>unset PYTHONPATH
</code></pre>
<p>Is there an equivalent or any other way to use conda’s cuda?<br>
<br></p>
<pre><code>0S-CentOS 6.5
Conda-4.3.27
Conda's python - 3.6.5</code></pre>