eddelbuettel / r2u

CRAN as Ubuntu Binaries
https://eddelbuettel.github.io/r2u
247 stars 17 forks source link

Is it necessary to install bspm through R? #63

Closed GreatEmerald closed 4 months ago

GreatEmerald commented 4 months ago

In the readme, it suggests installing the bspm package through R:

https://github.com/eddelbuettel/r2u/blob/05f53717df26b42800ae69444b2ece7bdd526492/README.md?plain=1#L189

However, in the previous steps, the r2u and CRAN repositories have been added to the system. Wouldn't it be simpler to make use of that and thus do:

apt-get install r-cran-bspm

Or is there any particular reason why it needs to be installed through R?

For context, I'm making an Ansible script to install r2u to automate the deployment, and to me it would make more sense to use apt rather than having to call R at that point.

eddelbuettel commented 4 months ago

Yes you should. The .deb I create for CRAN bspm is not good enough. The 'meta reason' is that bspm does some magic that needs more Python and system integration so the recommendation (also at the bspm repo) is to, if in doubt, do sudo Rscript -e 'install.packages("bspm")' for which one (depending on what is turned on on your system may also need the variant sudo Rscript -e 'bspm::disable(); install.packages("bspm")' to ensure you really get a source installation.

Let me know if I should make that clearer in the docs.

In setups where I can control this (eg Docker) I do add an explicit step to make sure this works. You Ansible script likely needs the same. Just think of bspm (for planned use with apt and everything that make r2u so special) as a build-requirement.

But in case you never want to install R packages via install.packages() and the (entirely optional) use of bspm then this does not apply. apt alone does not care as long as it does not get invoked from R via bspm.

/cc @enchufa2

GreatEmerald commented 4 months ago

Indeed, if I do it only via apt, then any install.packages call results in an error about not being able to launch dbus. Installing the package through R works. That's a bit unfortunate because it means that either I have to somehow code an extra step to check if the package is already installed, or have the package get reinstalled every time I run the Ansible script. But oh well, at least the rest worked flawlessly, and the packages get installed in a flash now :)

eddelbuettel commented 4 months ago

It is not dissimilar from other foundational tools I install in Docker containers -- littler comes to mind as I then use all the scripts it provides (install.r, install2,r, upgade.r, build.r, rcc.r and so on ...) bspm simply is foundational so if you want it (recall that is optional: you can get to the apt repos directly with just apt too) you have to pay that tax of an extra step.

Or send me a script that reliably build r-cran-bspm with the needed systemd pieces. I have not had time to cook one.

I will close this now as this is in fact known and documented. Should you encounter other issues please feel free to raise another issue. And thanks for giving r2u a go. It rules my world.

GreatEmerald commented 4 months ago

I managed to make an Ansible script for it now, for reference you can find it here: https://github.com/GeoScripting-WUR/InstallLinuxScript/blob/master/noble/virtualbox.yml The integration with systemd sounds like an interesting thing to look into, but unfortunately no time at the moment, so the extra step will suffice for now!

eddelbuettel commented 4 months ago

You have the systemd integration via bspm when installed as root via R. You're good.