-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[R-package] Installation with pre-compiled DLL fails: 'cannot create dataset handle' #2714
Comments
Hello @abhmodi . I tried running this code from your example on the latest version of the library(lightgbm)
lgb.unloader(wipe=TRUE)
require(lightgbm)
data(ChickWeight) # Built in data set
ChickWeight <- sapply(ChickWeight, function(x) as.numeric(as.character(x)))
y <- ChickWeight[,"weight"]
x <- ChickWeight[,!colnames(ChickWeight)=="weight"]
dtrain <- lgb.Dataset(
data = as.matrix(x)
, label = as.numeric(y)
, free_raw_data = FALSE
)
lgb.Dataset.construct(dtrain) The only thing I changed was adding a I am on macOS Mojave and R 3.6.1. Can you please give me some more information?
|
Hi @jameslamb, thank you for getting back. Please find the details below and do let me know if you need any other information. I am using R-3.5.2 and Windows 10 Steps I used for installing lightgbm R package
Please find below the log that I got from running the code above: |
hmmmm ok. Thank you for the summary! I have a few more questions below. I'm not as familiar with the "install with a precompiled dll" part of this project, so if I can't figure it out after hearing your answers to these questions we'll need to get help from @Laurae2
How did you download it? With
Why did you have to do this? That is already handled in https://github.com/microsoft/LightGBM/blob/master/build_r.R#L62-L67
Do you mean
Do you mean |
Thank you @jameslamb for helping :)
I downloaded the precompiled DLL from here
I did just reading a StackOverflow answer
Yes, I mean USE_R35. Sorry for the trouble
Yes, I got the below message when I hadn't hardcoded the src variable (in install.libs.R file) After manually updating SRC variable in install.libs.R file: Again, thank you for all the help :) |
hi guys, any solution for this problem, I have the same exact error although I installed and loaded it successfully ? |
@Laurae2 Is this something you can help with? I haven't been able to produce this on Mac or Linux so I feel it might be Windows-specific, and I don't have an easily-available Windows environment to test in. Sorry for the delay @ningistine7 and @abhmodi . Until we figure this out, could you install from source instead of the precompiled dll? |
Hi, I have the same problem. I have followed these recommendations I was able to install it but I have this error: Error in data $ construct (): I have R version 3.6.3 (windows). Thanks for the help! Question: Will lightgbm ever be available from the CRAN? |
@Edimer thanks for the report. Sorry, but I cannot completely read those instructions (I only speak English). I do see that they're almost a year old...could you try with our current installation instructions. As far as I can tell from your comment and the previous ones, maybe there is a problem with building from a precompiled
Yes definitely! My primary focus right now is getting the package to CRAN. You can follow the progress in #629. I left the most recent update in #629 (comment). |
@abhmodi hope it is ok, I changed the issue title based on the new evidence from @Edimer and @ningistine7 |
Ok, thanks @jameslamb for your help. I'll keep trying and keep an eye out for LightGBM in CRAN. |
Hi @jameslamb, I hope you are very well. I have overcome the problem of 'cannot create dataset handle', however when I try to replicate the example with agaricus.train I have the following error: Error in .Call (fun_name, ..., ret, call_state, PACKAGE = "lib_lightgbm"): Any ideas regarding this error? I followed the installation instructions...but I still can't get it on Windows (on Linux yes). Thank you. |
Can you please clarify (copy and paste the exact code) how you installed the package? The README link you provided offers multiple alternatives for installing the R package. |
Hi @jameslamb, It worked! I used the following code (which is in the installation instructions in R):
It worked for me with the following specs:
I really appreciate your help and patience ... Your work is excellent! |
Thanks @Edimer , glad it is working! I'm going to close this issue since the last response from other posters was a while ago. For those finding this issue from search engines...please comment if you face an issue building the R package with a pre-compiled DLL and we will re-open it. If not, please open a new issue and we will be happy to help you! |
Could you please explain how you solved the problem of this error? Error in .Call(fun_name, ..., ret, call_state, PACKAGE = "lib_lightgbm") : It was a real pain to install the package itself on my machine! But, after trying it for several days, it finally got installed. However, when I try to run anything, I get the same exact error. I have: |
@RaminZi can you please tell me the exact code you ran to install Can you please run the steps from our installation documentation for the R package and share the log with me?
|
Wow! Thanks for your super fast response James! So, I followed the exact steps from the installation guide you just mentioned, and it did not work. It was not just me though! I was taking ML course this semester, and 3 other friends of mine also tried to install it but they could not (I think they all were using Windows). Anyway, after searching for a solution online for a few days, I tried almost everything I found but still no luck. Lastly, it was mentioned somewhere that it would not work if both versions of R (x32, x64) are installed on a machine. The solution was to use this "--no-multiarch", so it would not use both versions (?) (it's just my understanding). After that, I got it to work, but then I would get that error. Thanks again. |
^ this question is important. We know we had some recent issues with Visual Studio installations of the R package, which were just fixed (#2963).
We haven't tested with R4.0 yet so I am curious to see what you find. Please do let me know if our installation instructions work for you, and thanks for using |
It must have been before April 7th. Ramin |
Ok. So, this is what happened. I installed only the x64 version of R 4.0.0 (unchecked the x32 during the installation). Then, I ran those 3 lines you mentioned. git clone --recursive https://github.com/microsoft/LightGBM However, when was running the last line with that Rscript, it gives me an error. I'm attaching the error here. After that, I tried the following process I got to install the package. git clone --recursive https://github.com/microsoft/LightGBM copy everything from release folder into Lightgbm root folder Run R.exe CMD INSTALL --build . inside lightgbm_r folder [Passed] After all this, it was installed on my machine. However, when I run a code to see if it was installed correctly, I get the error I mentioned yesterday. These are what I have on my machine: Visual Studio 2019 Thanks for your time. |
@RaminZi thanks for the thorough report! Now that you've updated to R4.0, I'd like to split the conversation. For your report about running the steps I suggested but with R4.0, please follow along at #3064 For the issue of using a precompiled DLL, you can stay here in this issue and we'll keep it open. I think that #3064 is a higher priority right now, since that is a more common and better-supported way to build the R package, so that is going to be what I work on first. The approach you tried is not documented in our installation documentation for the R package because it is not recommended. You likely got the error you got there because building The cmake -DBUILD_FOR_R=ON -DUSE_R35=ON -DCMAKE_R_VERSION='4.0.0' -G "Visual Studio 16 2019" -A x64 .. That's kind of complex, which is why we don't ask people to run it directly and instead include it inside code that eventually gets called when you run Also, in the future could you please provide logs in text instead of screenshots? That makes it easier for others to find these issues from search engines, for example by searching for the error message "LGBM_DatasetCreateFromCSC_R". Thanks again for using |
I'm going to close this issue due to inactivity. A lot of improvement have been made to the R package since May, which I hope have made it easier to install. Because of this, the ability to install from a pre-compiled DLL will be removed soon: #3360 |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Hi,
I tried other methods mentioned in earlier threads/issues about fixing such issues but none seem to work.
Apart from the below mentioned reproducible example, I had tried with code mentioned on the test code mentioned here: https://github.com/microsoft/LightGBM/tree/master/R-package#install
Running that code doesn't give "[LightGBM] [Fatal] Check failed: num_data > 0 at D:\a\1\s\src\io\dataset.cpp, line 30 ." error but only about "cannot create dataset handle"
Environment info
Operating System: Windows 10
CPU/GPU model:
C++/Python/R version: R-3.5.2
LightGBM version or commit hash: 2.3.2
Error message
[LightGBM] [Fatal] Check failed: num_data > 0 at D:\a\1\s\src\io\dataset.cpp, line 30 .
Error in dataset$construct() :
lgb.Dataset.construct: cannot create Dataset handle
Reproducible examples
lgb.unloader(wipe=TRUE)
require(lightgbm)
data(ChickWeight) # Built in data set
ChickWeight <- sapply(ChickWeight, function(x) as.numeric(as.character(x)))
y <- ChickWeight[,"weight"]
x <- ChickWeight[,!colnames(ChickWeight)=="weight"]
dtrain <- lgb.Dataset(data = as.matrix(x),
label = as.numeric(y),
free_raw_data=FALSE
)
lgb.Dataset.construct(dtrain)
Other methods tried from earlier threads/issues
The text was updated successfully, but these errors were encountered: