how to solve cpp library confliction within anaconda?


I tried to install lightgbm with gpu in anaconda. I used pip in anaconda directly with –install-option=’–gpu’. it’s built successfully and links to under /lib64.

as anaconda has it’s own under anaconda3/lib and it’s different from the one under /lib64, when I try to import lightgbm, I got the error saying

anaconda3/lib/ version GLIBCXX_3.4.29 not found (required by

what’s the recommend way to keep in anaconda consistent with lightgbm (or any other libraries) built outside anaconda?

do I need to find the cpp compiler information used by anaconda? where can I find such information?

Asked By: Lei Yu



As described in microsoft/LightGBM#5106, when building lightgbm from source in a conda environment on Linux, the most reliable way to avoid linking to a libstdc++ that is using a new GLIBCXX version than the one found by conda is to use conda‘s C/C++ compilers.

Like the following.

# create conda env with lightgbm's dependencies
conda create 
   --name lightgbm-env 
   -c conda-forge 

# install `conda`'s C++ build tools into that environment
conda install 
   --name lightgbm-env 
   -c conda-forge 

# clone LightGBM
git clone 
   --branch stable

# activate the conda env, so that conda's compilers are found first
source activate lightgbm-env

# install lightgbm with `pip`
cd LightGBM/python-package
pip install .

NOTE: This answer applies to lightgbm versions <=

Answered By: James Lamb