0

I have CentOS release 6.8 (Final) on my system. I have intalled the igrph-python by

conda install -c marufr python-igraph=0.7.1.post6

When I try to import the package I get the error:

ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /home/abolfazl/.python-eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so)

I searched for similar questions and found some answers. I tried them like this one. But still, I get the ImportError. Do you have any solution? Thanks a lot

Community
  • 1
  • 1
Abolfazl
  • 1,047
  • 2
  • 12
  • 29

1 Answers1

1

TL;DR:

conda install -yc nehaljwani python-igraph=0.7.1.post6

Okay, let's see which versioned dependencies exist for the shared library:

readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBC_)([\d.]*)' | sort -Vr | head -1
2.14

readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBCXX_)([\d.]*)' | sort -Vr | head -1
3.4.15

Let's see what the system provides:

strings /lib64/libc.so.6  | grep -Po '(?<=GLIBC_)([\d.]*)' | sort -Vr | head -1
2.12

strings /usr/lib64/libstdc++.so.6 | grep -Po '(?<=GLIBCXX_)([\d.]*)' | sort -Vr | head -1
3.4.13

As you can see, 3.4.13 is < 3.4.15 and 2.12 is < 2.14 and hence the shared library _igraph.so doesn't load.

Okay, so you got some options:

Alternative 1: Use conda's gcc and libxml2 build to build the package.

yum install -y gcc-c++ libxml2-devel
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
conda install -y conda-build
conda install -yc marufr python-igraph=0.7.1.post6
conda install -y gcc libxml2
export LD_LIBRARY_PATH=~/m2/lib/
conda build $CONDA_PREFIX/pkgs/python-igraph-0.7.1.post6-py27_0/info/recipe/
conda remove -y python-igraph
conda install $CONDA_PREFIX/conda-bld/linux-64/python-igraph-0.7.1.post6-py27_0.tar.bz2
python -c 'import igraph; print igraph.__version__'
0.7.1

Note here that I used gcc from conda, and I had to set LD_LIBRARY_PATH, so that while testing the package, it would pick $CONDA_PREFIX/lib/libstdc++.so instead of the system's libstdc++.so. So, the next time you use the package that you built yourself, you will have to install gcc using conda too. Meh, too much work.

Alternative 2: Build the package, but use system's gcc and libxml2

yum install -y gcc-c++ libxml2-devel
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
conda install -y conda-build
conda install -yc marufr python-igraph=0.7.1.post6
conda build $CONDA_PREFIX/pkgs/python-igraph-0.7.1.post6-py27_0/info/recipe/
conda remove -y python-igraph
conda install $CONDA_PREFIX/conda-bld/linux-64/python-igraph-0.7.1.post6-py27_0.tar.bz2
python -c 'import igraph; print igraph.__version__'
0.7.1

Note that this time, I didn't have to export LD_LIBRARY_PATH and depend on the old system libraries. Now, you don't require to install gcc using conda each time you use this package. But still, too much work, meh.

Alternative 3. Let pip do the compilation of the shared library: _igraph.so

yum install -y gcc-c++ libxml2-devel
bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
pip install python-igraph==0.7.1.post6
python -c 'import igraph; print igraph.__version__'
0.7.1

Alternative 4: I have built the package for you and put it on my channel. Feel free to use it :-)

bash Miniconda2-4.2.12-Linux-x86_64.sh -b -p ~/m2
source ~/m2/bin/activate
conda install -yc nehaljwani python-igraph=0.7.1.post6
python -c 'import igraph; print igraph.__version__'
0.7.1

Alternative 4 is the easiest as of now, but why does it work? Let's look at it's dependencies now:

readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBCXX_)([\d.]*)' | sort -Vr | head -1
3.4

readelf --version-info /root/.cache/Python-Eggs/python_igraph-0.7.1.post6-py2.7-linux-x86_64.egg-tmp/igraph/_igraph.so | grep -Po '(?<=GLIBC_)([\d.]*)' | sort -Vr | head -1
2.7

As you can see, 3.4 is < 3.4.15 and 2.7 is < 2.12 and hence the shared library _igraph.so now loads with the system's old libraries :-)

Nehal J Wani
  • 16,071
  • 3
  • 64
  • 89