0

I installed the latest version of lightGBM(lgb.__version__ == '2.2.1') which is supported by gcc8, but now I have a model already built with lightgbm==2.0.2 which is supported by gcc7.

I need to conform with the previous version, which means I have to downgrade current version of lightgbm, using pip install lightgbm==2.0.2, however when I import it, I met Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib.

I have checked here and here, the problem is I must use lightgbm of previous version.

I assume the problem is caused by gcc version, so is there a way I can install gcc 7?(by the way I tried create a virtualenv on my computer so that I can have both version of lightgbm, also can I install gcc 7 under the virtual environment and keep gcc 8 on my computer as well?)

Thanks soooo much!

MJeremy
  • 1,102
  • 17
  • 27
  • So I don't entirely know where your problem is but I would recommend uninstall both version completely if possible and reinstalling them in virtual environments so as to prevent future version issues. It is of course possible to keep one global and have another in just a virtual environment but it isn't recommended. – K-Log Oct 13 '18 at 07:49
  • How can I install `gcc 7`? I used `brew install gcc`, it will install the latest version. – MJeremy Oct 13 '18 at 12:20

1 Answers1

1

So to start off with, it looks like your problem has more to do with gcc than with your python module. While it is a best practice to use virtual environments for each project, that will only effect the lightgbm module and not your gcc version.

To accomplish what you are trying to do, I would recommend taking a look at the following:

Homebrew install specific version of formula?

Their solution is with postgresql but it should translate to most other programs installed with Homebrew.

The only other option I can think of would be to just use the newest versions of lightgbm and gcc but that doesn't appear to be possible for your project.

K-Log
  • 608
  • 3
  • 18
  • Thanks for you answer. I found out this works for me `cp -r /usr/local/opt/gcc@7/lib/gcc/7 /usr/local/opt/gcc/lib/gcc/` – MJeremy Oct 15 '18 at 10:29