Xgboost: Xgboos import on Anaconda - libstdc error

Created on 9 Jan 2017  路  12Comments  路  Source: dmlc/xgboost

For bugs or installation issues, please provide the following information.
The more information you provide, the more easily we will be able to offer
help and advice.

Environment info

Operating System: Fedora 25

Package used (python/R/jvm/C++): Python

xgboost version used: 0.6a2 (according to pip)

If you are using python package, please provide
The python version and distribution: Python 3.5 through Anaconda

Issue

Okay, so I installed xgboos over anaconda with pip install xgboost
I first had an error message on import stating that it could not find 'GOMP_4.0'. After installing the gcc package with anaconda and reinstalling xgboost, the error is gone but I now get the following error:

Traceback (most recent call last):
File "", line 1, in
File "/home/anogio/anaconda3/lib/python3.5/site-packages/xgboost/__init__.py", line 11, in
from .core import DMatrix, Booster
File "/home/anogio/anaconda3/lib/python3.5/site-packages/xgboost/core.py", line 112, in
_LIB = _load_lib()
File "/home/anogio/anaconda3/lib/python3.5/site-packages/xgboost/core.py", line 106, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "/home/anogio/anaconda3/lib/python3.5/ctypes/__init__.py", line 425, in LoadLibrary
return self._dlltype(name)
File "/home/anogio/anaconda3/lib/python3.5/ctypes/__init__.py", line 347, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/anogio/anaconda3/lib/python3.5/site-packages/scipy/sparse/../../../../libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /home/anogio/anaconda3/lib/python3.5/site-packages/xgboost/./lib/libxgboost.so)

Troubleshooting so far

It seems that something is missing, but the issue is I do not know how to find out what folders the ../../../../ refers to. When I look up the name libstdc in the scipy folde, nothing comes up, so I have nothing to replace.

I really have no idea how to fix that, I tried reinstalling scipy but it did not change a thing.

PS: I do not know how to properly attach shell output. For now anything between beacon marks is hidden (s.a.

Most helpful comment

I had the same problem when importing xgboost 0.6a2 (Anaconda, Python 2.7, Ubuntu 16.04). I had two errors:
libstdc++.so.6: version GLIBCXX_3.4.20' not found
libgomp.so.1: version `GOMP_4.0' not found

Solved by modifying the links in ~/anaconda2/lib:
libstdc++.so.6 -> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so -> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libgomp.so -> /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
libgomp.so.1 -> /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0

Hope that helps

All 12 comments

maybe you can try conda install libgcc which worked for many people from this #1043

Hi,
'conda install libgcc' doesn't work for me

strings /home/ros/anaconda3/lib/python3.5/site-packages/scipy/sparse/../../../../libstdc++.so.6 | grep GLIBCXX

shows:
GLIBCXX_DEBUG_MESSAGE_LENGTH
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21

Error says that we require version `GLIBCXX_3.4.22'

I have the same error. The 'conda install libgcc' brings the GLIBCXX version up to 3.4.20, not 3.4.22.
Also, the libstdc++ installed in /usr/lib/x86... has 3.4.22 but for some reason it searches and finds the anaconda directory for libstdc++.
Setting LD_LIBRARY_PATH does not seem to help.

I tried symlinking anaconda3/lib/libstdc++.so.6 to the library in /usr/lib/x86... which allows 'import xgboost' to proceed, but the first call to xgboost.train Segfaults.

The reason maybe is your gcc is too high when you compile the xgboost. And you should degrade your gcc or conda install gcc. conda install gcc solved my issue.

I had the same problem when importing xgboost 0.6a2 (Anaconda, Python 2.7, Ubuntu 16.04). I had two errors:
libstdc++.so.6: version GLIBCXX_3.4.20' not found
libgomp.so.1: version `GOMP_4.0' not found

Solved by modifying the links in ~/anaconda2/lib:
libstdc++.so.6 -> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so -> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libgomp.so -> /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
libgomp.so.1 -> /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0

Hope that helps

thanks! conda install libgcc works for me!

thanks @shlomyli modifying the link as described worked for me

@shlomyli, thanks for your solution.It works perfectly~

@roachsinai, Thanks! conda install libgcc works for me!

@shlomyli, thanks for your solution.

I have the same problem and have done the symbolic link for libgomp.so with no problem as @shlomyli posted above. I did this in both general anaconda and the specific environment's directories because I didn't know which one. The error went away and now I get a new error about libstdc++.so instead.

When I tried to do the same for libstdc++.so, it doesn't work. I did this in both the general anaconda and the specific environment's directories again. But it still complains about the directory I don't know what the "../../../../" is so I cannot go and link this thing correctly! Help!? :(

I did do conda install libgcc and conda install gcc already.

Also, when I did strings /home/puifais/anaconda3/lib/libgomp.so.1 | grep GOMP it could not find the GOMP_4.0 that's needed. So I did the symbolic linking which fixed the problem. But when I did strings /home/puifais/anaconda3/lib/libstdc++.so.6 | grep CXXABI, it found CXXABI_1.3.7 that it needed... I proceeded to create a symbolic link to the OS anyway, but that didn't seem to fix the problem.

Was this page helpful?
0 / 5 - 0 ratings