Lightgbm: Lightgbm R installation

Created on 11 May 2020  Â·  15Comments  Â·  Source: microsoft/LightGBM

Hi, everyone,

I'm trying to install lightgbm in R (Windows 10, RStudio 3.6.3). I have already read and tried steps in #2995 and #2997 but I have a problem at a stage;

C:\Users\MGS\LightGBM>git fetch origin r/msvc-support
fatal: couldn't find remote ref r/msvc-support

Then I have tried;

C:\Users\MGS\LightGBM>git pull r/msvc-support
fatal: 'r/msvc-support' does not appear to be a git repository.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.

But I got an error again. How can I solve this problem?
Thank you so much.

r-package

Most helpful comment

OH MY GOD! It worked! I have lightgbm package now! You're amazing and I really really appreciate what you are doing and your help. Thank you so much @jameslamb :)

All 15 comments

Thanks for using LightGBM.

Please follow the installation instructions in our official documentation: https://github.com/microsoft/LightGBM/blob/master/R-package/README.md#installation

If the instructions do not work, please comment here with some explanation of exactly the code you ran and what error message or other logs you are seeing and we will re-open the issue.

I've installed git and CMake(3.16.6)
I've installed Visual Studio Code (April 2020 version) (Actually, I want to use lightgbm in RStudio, so I have RStudio 3.6.3)
I've also installed RTools35.
Then, in cmd I wrote your instructions(both of them) and I get this;
Ekran Görüntüsü (64)
Ekran Görüntüsü (65)

Can you show me the value of your PATH environment variable? If make is not found, I suspect that you do not have Rtools directories on your PATH per https://github.com/microsoft/LightGBM/tree/master/R-package#windows-preparation.

By the way, the versions of R and RStudio are two different things. You can get your version of R by running R --version. That is probably 3.6.3.

Ekran Görüntüsü (66)

Your PATH looks like it has the right things in it. Did you start a completely new CMD shell after setting those environment variables?

What branch of LightGBM are you on? Your git clone command in the first screenshot failed so I'm not sure what is in the LightGBM directory you're working from.

Could you please start a new CMD window, remove the existing LightGBM directory you have, and run the code from the install instructions?

git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
Rscript build_r.R

I start a completely new CMD shell after setting environment variables but I got the same error again. Also, I've tried remove the existing LightGBM directory I have but I couldn't do that, so I wrote the command "dir LightGBM", it can be seen below;
Ekran Görüntüsü (67)

Can you please show me the output of running these two commands from that LightGBM folder?

git branch -v

git log -n 5

My concern is that by following comments from the issues you referenced (#2995, #2997), you may have your local LightGBM in a state that doesn't work any more. Since those comments were only temporary fixes for those issues which have now been fixed on master.

Ekran Görüntüsü (68)

Great, thanks! Can you please run git pull origin master to get the most recent changes, then try running Rscript build_r.R again?

If you get the same error about make not being found, then we will have to check if your Rtools entries in PATH are set up correctly. I could help with that if you show me a screenshot of Windows Explorer that shows the contents of C:\Program Files\Rtools.

I am really grateful for helping you so quickly but I got an error like this when I run "git clone master" so I couldn't try running Rscript build_r.R again.
Ekran Görüntüsü (69)

ha you are fast! I was thinking about two things at once and made a mistake while typing. There was a typo in my comment and I edited it immediately.

It should have been git pull origin master, not git clone master.

Okay, so I changed and it has become like this, as a result I got the same error again.
Ekran Görüntüsü (70)
So I also attach the screenshot of C:\Program FilesRtools
Ekran Görüntüsü (72)

aha! We are getting closer! I noticed that you have C:\Program Files\Rtools in your PATH. Can you please change it to C:\Program Files\Rtools\bin, close this CMD shell, open a new one, and re-run Rscript build_r.R from the root of the LightGBM repository?

I suspect that make is in Rtools\bin but not being found because your path ends in Rtools\.

If that's the case I'll make this clearer in our installation documentation, for those who aren't familiar with Rtools and/or setting their PATH.

OH MY GOD! It worked! I have lightgbm package now! You're amazing and I really really appreciate what you are doing and your help. Thank you so much @jameslamb :)

WOO AWESOME! I am glad it's working for you! Thanks for your patience and for using LightGBM!

For those arriving at this issue from search engines:

If you try to build the R package on Windows and get an error like "warning in system(cmd): 'make' not found", be sure that Rtools\bin is on your PATH environment variable.

Was this page helpful?
0 / 5 - 0 ratings