Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC version 8 not found after package install #1456

Closed
LouisTrigg opened this issue Jun 16, 2018 · 7 comments
Closed

GCC version 8 not found after package install #1456

LouisTrigg opened this issue Jun 16, 2018 · 7 comments

Comments

@LouisTrigg
Copy link

LouisTrigg commented Jun 16, 2018

I installed the package with pip (version 10.0.1) to my Python lib (version 3.6.3) on macOS Sierra (version 10.12.6), along with the dependencies found in the documentation, including open-mpi, cmake and gcc.

However, I kept receiving the following exception when I try to import the package using Jupyter notebook (version 5.0.0):

OSError: dlopen(/Users/admin/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib
Referenced from: /Users/admin/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found

brew install gcc installed version 9, and somehow only version 8 is in the /usr/local/opt/gcc/lib/gcc folder, but the filepath above shows the package is still searching for version 7, so I kept receiving the error until I specifically downloaded version 7 and manually inserted it in the /usr/local/opt/gcc/lib/gcc/ folder.

I'm confused about whether this an issue with the filepath or homebrew?

Steps to reproduce (corrected)

  1. Brew install open-mpi, cmake, gcc
  2. git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
    export CXX=g++-9 CC=gcc-9 # replace 7 with version of gcc installed on your machine
    mkdir build ; cd build
    cmake ..
    make -j4
  3. pip install lightgbm
@StrikerRUS
Copy link
Collaborator

There is no gcc-9 yet. You should use this command export CXX=g++-8 CC=gcc-8.
Same as #1369.

@StrikerRUS
Copy link
Collaborator

StrikerRUS commented Jun 16, 2018

Also your order of steps is incorrect. Firstly, build LightGBM library with this guide. Only after successful compilation you need to install Python-package:

cd LightGBM/python-package
python setup.py install --precompile

@LouisTrigg
Copy link
Author

Thanks. I may have been using gcc --version incorrectly to check the version from homebrew.

@LouisTrigg
Copy link
Author

I'm reopening this issue after originally closing it by thinking the problem was incorrectly assuming a version 9 for gcc in the line export CXX=g++-9 CC=gcc-9.

I double-checked everything by uninstalling and reinstalling via the following steps:

pip uninstall lightgbm

brew reinstall open-mpi 
brew reinstall cmake
brew reinstall gcc (resulting in version 8.1.0)

git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-8 CC=gcc-8
mkdir build ; cd build
cmake ..
make -j4

pip install lightgbm

However, I still received the same error when I imported the package into the notebook:

OSError: dlopen(/Users/admin/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib
Referenced from: /Users/admin/anaconda3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found

@StrikerRUS
Copy link
Collaborator

StrikerRUS commented Jun 16, 2018

You are doing everything right now , except one last step.

As I said before, you need run

cd LightGBM/python-package
python setup.py install --precompile

instead of

pip install lightgbm

Installing from pip you are getting precompiled version of the LightGBM library, which comes inside the wheel from the PyPI site and requires gcc-7 (@guolinke BTW, maybe it's time to update the version?). So, all your previous steps aimed to compile the library file are just ignored.

Of course, you can manually replace the library file into the Python-package in this folder /Users/admin/anaconda3/lib/python3.6/site-packages/lightgbm with one which you've just compiled. But agree that python setup.py install --precompile is much easier 😃 .

@guolinke
Copy link
Collaborator

@StrikerRUS yeah, we can update the version.

@LouisTrigg
Copy link
Author

@StrikerRUS It worked. You're right - compiling the library file is much more streamlined than the alternative. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants