Minimum glibc version for installation of pytorch when installing from source

Hi,
Is there a minimum version of glibc required for installation of pytorch when installing from source.
My system’s glibc is 2.12. I am trying to install pytorch = 1.3 on it.

I am not sure. Are you seeing any error with this glibc?

Yes, a lot.
I am installing pytorch from source on a remote server which already have some versions of Cuda, CMake, gcc, python installed.
OS is Cent OS - 6.5
As installing from source requires installing from conda so I installed it. I have to set it explicitly by using
unset PYTHONPATH
unset PYTHONHOME because otherwise it was picking up system’s python path.
Now, I am getting these errors
I am not sure whether these errors are creeping up because conda is picking the system’s gcc,CMake or whether it is because of glibc error which this Stackoverflow answer is pointing.

you shouldn’t need to change the pythonpath and home in conda.
Did you properly activate the conda environment?

if I am not changing the pythonpath and home then I am getting
from conda.cli import main ModuleNotFoundError: No module named 'conda'

Did you properly activate the conda environment?

No, because it is not getting activated as I am getting

from conda.cli import main ModuleNotFoundError: No module named 'conda'
when I am trying to activate it.

Ho, sorry I did not understood that from your previous post.
I would solve this issue first before trying to install pytorch. Because if it is not activated properly, then the given instructions won’t work.

Have you checked google for that error? Answers like: https://stackoverflow.com/questions/19825250/after-anaconda-installation-conda-command-fails-with-importerror-no-module-na seem relevant to your problem.

No problem, let me sum it up my issues
I have solved the activation of conda environment problem by using
unset PYTHONPATH

unset PYTHONHOME

Now, the conda environment is activated. Now, when I run
python setup.py install --user as directed from the source,
I am getting

Building wheel torch-1.4.0a0+c63e15a
-- Building version 1.4.0a0+c63e15a
cmake --build . --target install --config Release -- -j 16
/nethome/rxs1576/anaconda3/bin/ninja: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /nethome/rxs1576/anaconda3/bin/ninja)
/nethome/rxs1576/anaconda3/bin/ninja: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /nethome/rxs1576/anaconda3/bin/ninja)
/nethome/rxs1576/anaconda3/bin/ninja: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /nethome/rxs1576/anaconda3/bin/ninja)
Traceback (most recent call last):
  File "setup.py", line 751, in <module>
    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/conda_env/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '16']' returned non-zero exit status 1.

Hi,

After looking internally, the oldest version we support is the one from RHEL7 I’m afraid :confused:
Maybe you can use conda to get a more recent glibc package than your system one :slight_smile:

1 Like

I just updated my glibc version from 2.12 to 2.18.Now, on doing
python setup.py install, I am getting
Segmentation fault (core dumped)

Make sure to clean the previous installs / other libraries that you already installed with the older glibc.

still the same error.:frowning_face:

Where does the segfault happens? do you have a proper compiler to work with this new glibc?

I think i am having an issue of having multiple glibc versions now.
On running,

ldd (GNU libc) 2.18
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

while on running
/lib/libc.so.6 ,I am getting-

GNU C Library stable release version 2.12, by Roland McGrath et al.
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-4).
Compiled on a Linux 2.6.32 system on 2013-11-21.
Available extensions:
	The C stubs add-on version 2.1.2.
	crypt add-on version 2.1 by Michael Glad and others
	GNU Libidn by Simon Josefsson
	Native POSIX Threads Library by Ulrich Drepper et al
	BIND-8.2.3-T5B
	RT using linux kernel aio
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

If you installed the second one with conda. The original one that was in your system should still be there. Just that the conda version should always be found first when your conda environment is activated.

Then I don’t know where I am doing wrong.
Where does the segfault happens?
When running python setup.py install or even starting python in terminal.
do you have a proper compiler to work with this new glibc?
I have a gcc-4.4, though I can upgrade it to 5.5.

When running python setup.py install or even starting python in terminal.

If just running python segfaults then the issue is not with pytorch. Most likely your python expects the old glibc and crash with the new one. You will need to get a python that works with this new glibc. Once you can run python with no error in the terminal, you can try to install pytorch again.

I have a gcc-4.4, though I can upgrade it to 5.5 .

Pytorch now requires gcc 5+ to compile. So you should upgrade your compiler (inside conda if you don’t want to change the system one).

I am trying to update my python to 3.7, I’ll update you after installing it.
Also, is there any cuda version limitation when installing pytorch from source. I have cuda version of 9.1.

I don’t remember on top of my head but the most recent the better (especially cudnn for speed). Here again you have conda packages that contain that, so it should be fairly easy to upgrade.

1 Like