microsoft / planetary-computer-containers

Container definitions for the Planetary Computer
MIT License
53 stars 12 forks source link

Add torch backend for sits [R] #36

Open TomAugspurger opened 2 years ago

TomAugspurger commented 2 years ago

https://github.com/conda-forge/staged-recipes/pull/13992 was an attempt to package with conda-forge. Ran into an issue described in https://github.com/mlverse/torch/issues/341 (perhaps something about how mlverse/torch is bundling binaries?). Doesn't look straightforward to do via conda / conda-forge.

Perhaps we can get some / all of the binaries from the Linux binaries RStudio provides.

gilbertocamara commented 2 years ago

I installed torch on an Azure VM with Ubuntu from CRAN (install.packages("torch"). It ran nicely and I managed to use it correctly.

gilbertocamara commented 2 years ago

I don't think you need to write a conda package. The normal CRAN install works.

gilbertocamara commented 2 years ago

Dear @TomAugspurger, I have interacted with Daniel Falbel, who is the torch maintainer for R. My guess is that the problems arise from the fact that CRAN does not allow packages to include external binary libraries. The package torch for R needs two C++ libraries (libtorch and liblantern) that have to be loaded on runtime. Thus, it is not self contained. The first time any torch function is called on an R script, these libraries are called.

gilbertocamara commented 2 years ago

If you want, we could prepare a Docker container with typical packages required by R applications that use EO data, e.g., rgdal, rstac, sf, etc.

TomAugspurger commented 2 years ago

Thanks. I pursued the current conda-based setup since we need to have the UI packages (like jupyterlab / notebook) which are a mixture of javascript and Python, in addition to the analysis libraries, and I didn't want to maintain multiple build systems for the various environments.

But if we're trying to push more complex packages into the R environment, it might make sense to switch how we do that environment. I think we could use or build off something like @cboettig's rocker project.

gilbertocamara commented 2 years ago

Hi @TomAugspurger, we will work with our team to prepare an R container similar to rocker.