torch icon indicating copy to clipboard operation
torch copied to clipboard

Better diagnostic message on missing dependencies if possible

Open balbirthomas opened this issue 1 year ago • 3 comments

After installing R torch loading the library (library(torch)) results in the following message requesting to install additional software even though all the dependencies (listed in DESCRIPTION) were already present

> library(torch)
ℹ Additional software needs to be downloaded and installed for torch to work correctly.
Do you want to continue? (Yes/no/cancel) no
Warning message:
ℹ Failed to install torch, manually run install_torch()
✖ Aborted. 

It would be useful if the message would give some indication of which was the missing dependency, if this is possible.

Note: I built and installed the R torch library as a deb package using to debian tool dh-make-R. The list of all files installed by this package are attached in files.txt

balbirthomas avatar Mar 01 '23 22:03 balbirthomas

Hello,

that "additional software" does not refer to R packages, but to libtorch, a C++ library that is needed by torch (just like by PyTorch). See also

https://torch.mlverse.org/docs/:

torch can be installed from CRAN with:

install.packages("torch")

You can also install the development version with:

remotes::install_github("mlverse/torch")

At the first package load additional software will be installed.

skeydan avatar Mar 02 '23 08:03 skeydan

I suspect that if you set the env var TORCH_INSTALL=1 before calling dh-make-R you will get a working package with all dependencies included - as it will allow downloading the dependencies in the build step. FWIW the additional dependecy is listed in the DESCRIPTION file:

https://github.com/mlverse/torch/blob/7d03c54d088eac23b84ff64096ea93b403e0146f/DESCRIPTION#L23-L24

I agree that we can improve the error message, giving more details of what's missing and what will be installed.

dfalbel avatar Mar 02 '23 09:03 dfalbel

Thank you.

I do have libtorch-dev from Debian installed on my system. List of installed files is shown in torch.txt.

Looking at install.R seems like install_torch() is also looking for liblantern . This does not seem to be installed in Debian using apt-get install libtorch-dev. I wonder if this is the issue.

balbirthomas avatar Mar 02 '23 23:03 balbirthomas