Posts Technical Problems collection
Post
Cancel

Technical Problems collection

Probelms about the environment variables.

  1. I installed the new version of R and Rstudio on the mac, but every time I open the Rstudio, the following warning messages would appear:
    1
    2
    3
    4
    5
    
    1: Setting LC_CTYPE failed, using "C"
    2: Setting LC_COLLATE failed, using "C"
    3: Setting LC_TIME failed, using "C"
    4: Setting LC_MESSAGES failed, using "C"
    5: Setting LC_PAPER failed, using "C"
    

    After reading the guidance on the stackoverflow post, I write the following code on the terminal and problem got solved.

    1
    
    defaults write org.R-project.R force.LANG en_US.UTF-8
    
  2. To use the LightGBM for multi-threading, I installed OpenMP. But after that, I cannot use XGBoost again. Not after restarting the computer and reinstall the package on Anaconda. Whenever I tried to import XGBoost, the following error would occur:
    1
    2
    3
    
    /anaconda3/lib/python3.6/site-packages/xgboost/core.py in <module>()
     134 
     135 # load the XGBoost library globally
    

    The posts said it’s due to the gcc version. To solve this problem, I referenced github post and Installing XGBoost on Mac OSX to fix this problem.

The gcc version of my mac is 8, so I used the following code.

1
2
export CC = gcc-8
export CXX = g++-8

I tried to use gcc --version, but the result is version 9, which is not right. So I tried to use brew install gcc and it told me the version is 8.

By the way, the directory of anaconda packages is

1
/anaconda3/lib/python3.6/site-packages/

And when I got everything done, I could import xgboost, but cannot import plot_importance from xgboost. The way I solved this is to restart the jupyter notebook and it worked.

Similar thing happens to lightgbm. So I used conda uninstall lightgbm to uninstall it and then install it from the binary source. Reference is the Microsoft/LightGBM. And since I don’t have cmake, I used brew install cmake to install it.

1
2
3
4
5
6
conda uninstall lightgbm
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-8 CC=gcc-8
mkdir build ; cd build
cmake ..
make -j4

However, error eccurs at this time, so the final decision is to uninstall it and use conda to reinstall lightgbm. The thing is the openmp will be downgraded. This is an open question.

Updated Feb 23, 2020 2020-02-23T15:14:05-06:00
This post is licensed under CC BY 4.0