mind / wheels

Performance-optimized wheels for TensorFlow (SSE, AVX, FMA, XLA, MPI)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot run on CentOS with glibc 2.17

nyunyunyunyu opened this issue · comments

The glibc version of this wheel is 2.23. It maybe a bit higher for CentOS users. Is it possible to provide a whl with lower glibc version?

/home/18781a/venv/lib/python2.7/site-packages/tensorflow/__init__.py in <module>()
     22 
     23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
     25 # pylint: enable=wildcard-import
     26 

/home/18781a/venv/lib/python2.7/site-packages/tensorflow/python/__init__.py in <module>()
     47 import numpy as np
     48 
---> 49 from tensorflow.python import pywrap_tensorflow
     50 
     51 # Protocol buffers

/home/18781a/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
     70 for some common reasons and solutions.  Include the entire stack trace
     71 above this error message when asking for help.""" % traceback.format_exc()
---> 72   raise ImportError(msg)
     73 
     74 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "/home/18781a/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/18781a/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/18781a/venv/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: /usr/lib64/libm.so.6: version `GLIBC_2.23' not found (required by /home/18781a/venv/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)


Failed to load the native TensorFlow runtime.

It may be easier for you to install glibc 2.23 on your system. This way you will be able to use all other wheels (and other stuff depending on 2.23) in the future too.

mkdir ~/glibc
cd ~/glibc 

wget http://ftp.gnu.org/gnu/glibc/glibc-2.23.tar.gz
tar zxvf glibc-2.23.tar.gz
cd glibc-2.23
mkdir build
cd build

../configure --prefix=/opt/glibc-2.23
make -j4
sudo make install

export LD_LIBRARY_PATH=/opt/glibc-2.23/lib

Actually I had tried this solution, but I got the following error.
/home/18781a/venv/bin/python2: relocation error: /home/18781a/venv/opt/glibc-2.23/lib/libc.so.6: symbol _dl_find_dso_for_object, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference

It seems that I need recompile everything with the new glibc. Is there a solution for this?

What command were you running when you see the error? To clarify, don't replace the existing glibc - it's needed by the system itself.

It should be the case that 2.23 is only used when export LD_LIBRARY_PATH=/opt/glibc-2.23/lib is set - and that's when you need to run TF.

Basically every command, even ls. I don't replace the existing glibc. I think it's a common issue. There is some discussion at https://maskray.me/blog/2015-09-29-specify-dynamic-linker-to-use-higher-version-gcc.

That's because you have LD_LIBRARY_PATH=/opt/glibc-2.23/lib when running ls. Try only use it for TensorFlow.

That's similar to what the article said (if you don't want to recompile, set LD_LIBRARY_PATH at runtime).

Want to check in to see if the issue still persists. If things are good I'll go ahead and close this issue.

I'm having the same issue. After installing glibc-2.23, If I set LD_LIBRARY_PATH=/opt/glibc-2.23/lib, the command python doesn't wok anymore actually. I tried setting os.environ['LD_LIBRARY_PATH'] = '/opt/glibc-2.23/lib' from within the interpreter but still having the same error when importing tensorflow:
ImportError: /lib64/libm.so.6: version 'GLIBC_2.23' not found (required by /root/anaconda3/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so).
I'm using Centos 7.

EDIT : I was able to make it work by setting export LD_LIBRARY_PATH=/root/anaconda3/lib, and manually copying /opt/glibc-2.23/lib/libm.so.6 to /root/anaconda3/lib

Glad to know that there's a solution. Thanks for posting and closing.

after copying /opt/glibc-2.23/lib/libm.so.6 to /../anaconda2/lib, 'import tensorflow as tf' cannot work anymore.. it says 'Illegal instruction (core dumped)' and exit python.
could you please help me solve this?

commented

I think this blog has a tutorial to build TensorFlow for CentOS 6
https://blog.abysm.org/2016/06/building-tensorflow-centos-6/

@ymarzougui

I copied libm.so.6 to anaconda2/lib folder, I got the following error:
ImportError: /usr/lib64/libstdc++.so.6: version CXXABI_1.3.8' not found`

My gcc version is 4.8.5 and I'm using centos 7

after copying /opt/glibc-2.23/lib/libm.so.6 to /../anaconda2/lib, 'import tensorflow as tf' cannot work anymore.. it says 'Illegal instruction (core dumped)' and exit python.
could you please help me solve this?

have you solved this? i'm facing the same problem

For anyone else running into this issue, I was able to solve it by following this post. I have CentOS 7.9.

Some details:

  • install glibc locally
  • apply the patch to the python binary with patchelf
  • now you still might have to merge the system libraries with the newly compiled glibc libraries, otherwise some errors like CXXABI_1.3.8' not found could occur (as described here)
    • in the glibc output folder, do: for x in /lib64/*; do ln -s $x lib_tmp; done
    • then overwrite the linked system libraries (in the temporary folder!) with the newly compiled libraries
    • rename the compiled glibc lib folder to e.g. lib_bck, rename lib_tmp to lib (now the patched binary will look here for the library files)
  • finally, before executing python you have to include the conda libraries export LD_LIBRARY_PATH=<...>/anaconda3/lib