6

I am trying to install pytorch on a remote server. It has CentOS 6.5 and according to this link it has stopped support for CentOS 6. So, I am trying to install it via source.
The recommended method to install is by anaconda but the thing is I am getting plenty of issues while installing anaconda as it is messing with the remote server path's alot so I have decided to use pip.
But I have issues regarding converting some conda commands in pip which are as below-

conda install -c pytorch magma-cuda90
The above command is mentioned before the pytorch cloning step and it given me an error that
Could not open requirements file: [Errno 2] No such file or directory: 'pytorch'
The other issue I am facing is below-
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"} Wht should be the alternative for CMAKE_PREFIX_PATH in pip?

Bing
  • 631
  • 1
  • 8
  • 23

1 Answers1

7

According to your Python version, you can try to install from the wheel files.

pip install https://download.pytorch.org/whl/cu101/torch-1.3.0-cp36-cp36m-manylinux1_x86_64.whl   --user # For torch 
pip install https://download.pytorch.org/whl/cu101/torchvision-0.4.1-cp36-cp36m-linux_x86_64.whl  --user # For torchvision

If it fails you may want to check your glibc version:

ldd --version

because PyTorch is supported on Linux distributions that use glibc >= v2.17.

For your question:

What should be the alternative for `CMAKE_PREFIX_PATH in pip ?

CMAKE_PREFIX_PATH act as a build directive to indicate where to find modules needed for the build. In your case (installation as non-root with the --user flag) it's probably:

~/.local/lib/python3.6/site-packages

You can verify the exact location with the following command:

python -c "import site; print(site.getsitepackages()[0])"

As a side note your compilation will more likely fail if you still don't have the minimum required version of glibc.

RMPR
  • 3,368
  • 4
  • 19
  • 31
  • I have tried this method and I got ` from torch._C import * ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /nethome/rxs1576/.local/lib/python3.6/site-packages/torch/_C.cpython-36m-x86_64-linux-gnu.so)` – Bing Oct 29 '19 at 23:18
  • I ran this command `ldd --version` and I hope this gives the libc version and I got `ldd (GNU libc) 2.12` so where I am doing wrong – Bing Oct 29 '19 at 23:22
  • But I need pytorch greater than or equal than 1.0 and I have not been able to get it from the above method – Bing Oct 29 '19 at 23:29
  • 1
    Check [this article](https://serverkurma.com/linux/how-to-update-glibc-newer-version-on-centos-6-x/) on how to upgrade manually glibc – RMPR Oct 29 '19 at 23:33
  • I don't have the sudo access to the server so I can't install glibc – Bing Oct 29 '19 at 23:39
  • 1
    Alternatively, because building glibc from source is long and tedious, you can check [How can I install an rpm without being root](https://superuser.com/questions/209808/how-can-i-install-an-rpm-without-being-root) or [rpm without root](https://serverfault.com/questions/100189/rpm-without-root) – RMPR Oct 29 '19 at 23:50
  • will the same issue of glibc will lie if I moved to installing by conda – Bing Oct 31 '19 at 00:45
  • Likely yes, see [this](https://gist.github.com/michaelchughes/85287f1c6f6440c060c3d86b4e7d764b), the first step is to update glibc and libc++ and [this thread](https://github.com/pytorch/pytorch/issues/6607) (the last comment states errors with setup.py – RMPR Oct 31 '19 at 06:42