rocker-org / rocker-versioned2

Run current & prior versions of R using docker. rocker/r-ver, rocker/rstudio, rocker/shiny, rocker/tidyverse, and so on.
https://rocker-project.org
GNU General Public License v2.0
419 stars 181 forks source link

What is the recommended workflow to update system libraries required by packages? #730

Closed GMFranceschini closed 1 year ago

GMFranceschini commented 1 year ago

Container image name

rocker/tidyverse:4.2.1

Container image digest

No response

What operating system related to this question?

Linux

System information

Singularity 4.0.1 Ubuntu 22.04

Question

Good evening, I am looking for advice on how to manage additional system dependencies once I have built my container. I am currently binding my R library from the local machine to the container, but some packages require additional system libraries (like say iGraph requiring libglpk-dev). I don't now all the packages I will use in advance, so I would like a workaround to add them.

How would you add such a library to the container, possibly without rebuilding it or using sudo? I expect this to happen from time to time. Also, as I am using singularity, it is not straight-forward to edit the Dockerfile, and I would probably need to go through a Docker image and then convert it to singularity. Any advice is appreciated, thank you

eitsupi commented 1 year ago

I think it's definitely writing a Dockerfile. Also, I'm not sure if I can do it around the use of sudo. pak has the ability to automatically install dependencies, but the sudo command is still required.

GMFranceschini commented 1 year ago

Thank you for your answer. My current attempt is to convert the Dockerfile into a Singularity definition using spython and then provide an additional script to install the required libraries on top of the image. The only inconvenience is that this should be done each time a new library is added, but I hope this won't be so frequent

eddelbuettel commented 1 year ago

(For completeness: If you start from the rocker/r2u container everything is handled by apt i.e. when you add igraph even via the standard install.packages("igraph") adds everything as needed by apt. But that isn't the versioned stack so you may have a preference for it. Otherwise see here about r2u.)

GMFranceschini commented 1 year ago

Wow @eddelbuettel , this sounds exactly what I was looking for! Let me understand if I got this correctly: for my use case, I will build upon this Dockerfile (https://github.com/rocker-org/r2u/blob/master/jammy/Dockerfile) to add Rstudio/Rserver, and then my container will have capabilities to install all R packages including the required system libraries. If I got this right, I believe this might be an optimal solution.

eddelbuettel commented 1 year ago

Yes! I have been using this left right and center for CI, debugging, deployment, ... and it is great. (I also just built a debugging variant for r-devel, not yet pushed.) And it just works -- we shipped north of 10 million binary packages in the 1 1/2 years it has been up.

One thing I have not done for lack of time / lack of someone pushing is to maybe build on top and 'simply' add rstudio desktop and/or server. It should be rather straightforward. (I even keep a PPA for my use with Ubuntu .deb files for rstudio server and desktop but that uses nightlies which one may not want here.) I'd be happy to bounce that off you especially if you can lead the local experimentation. Do you want to open a ticket at the r2u repo?

GMFranceschini commented 1 year ago

Absolutely, I am looking forward to experimenting and getting this working with RStudio as well, I think it could benefit many. As a disclaimer, I am not very knowledgeable about containers, but I am very happy to update you in case of success! I'll close this issue and we can move into the r2u repo. I'll post there over the next few days, hopefully with good news!