I’ve had a couple of questions come to me via email regarding R on Binder. The first is how often is the version of R updated as the user considers 3.4.4, which is currently installed, to be old.
The other issue they have is that a couple of image rendering packages (gifski and ggimage) are not being found by the library() command in the script. Both are present on MRAN and their published date is earlier than the date given in runtime.txt. They were wondering if maybe there was an aspect of the Binder local environment causing this issue? Any advice would be greatly appreciated!
I think the best answer we have is “When someone asks”. Right now the team that looks after repo2docker doesn’t contain any active R users. This means we are flying a bit blind, especially because the goal of repo2docker is to follow where the community of each programming language goes, not lead the way. So if the people who emailed you have opinions and thoughts it would be great if you could direct them to the repo to open an issue.
(As always there is some technical discussion/work that needs to happen because it never is as easy as just updating something )
We currently install R via Ubuntu’s package manager, so without work we are “stuck”.
There has been an idea to use conda-forge to install the R binary (not R packages). This would give us more flexibility and maybe even open the door for repos to specify which version of R they want in the repo, alongside the MRAN date.
Many thanks. I’ve opened an issue at https://github.com/jupyter/repo2docker/issues/661 wrt different versions of R and a bit of rationale as to why this is important in the context of reproducible research in my area.
In terms of the package errors, I’ve checked things like the paths but suspect it’s something else. When trying to install ‘gifski’ the following error appears in RStudio in my Binder:
------------------ RUST COMPILER NOT FOUND --------------------
Cargo was not found on the PATH. Please install cargo / rustc:
When trying to install ‘ggimage’, it looks like there’s a problem installing one of the dependencies (magick) as this error appears:
installing source package ‘magick’ …
** package ‘magick’ successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘Magick++’ found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick+±6.Q16
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because Magick++ was not found. Try installing:
csw: ‘imagemagick_dev’ (Solaris)
On MacOS it is recommended to use install ImageMagick-6 from homebrew
with extra support for fontconfig and rsvg rendering:
brew reinstall imagemagick@6 --with-fontconfig --with-librsvg
For older Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
sudo add-apt-repository -y ppa:opencpu/imagemagick
sudo apt-get update
sudo apt-get install -y libmagick+±dev
If Magick++ is already installed, check that ‘pkg-config’ is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars=‘INCLUDE_DIR=… LIB_DIR=…’
Which I’m not quite sure what to do with. I think Binder is a phenomenal idea btw with huge potential for improving reproducibility in research.
This tells you that you need to install a rust compiler for gifski to work. The tool used to build images from repos that BinderHub uses is repo2docker and we have a special file called apt.txt where you can list packages that should be installed via apt-get: Configuration Files — repo2docker 2023.06.0+43.gc6f97e5 documentation for some docs. Hopefully that will sort out the problem of the rust compiler.
I think for magick the solution is the same: install libmagick+±dev by adding it to a apt.txt in your repo.
I am so pleased reading the issue you created. It lays out what is needed, why, how to get there and that you don’t know how much work it would be. Perfect.
For context: we only just introduced issue templates and we had a few discussions already (thanks @KirstieJane!) on what to put into them, which questions to ask, is it too long/too short, etc. So I am happy to see that with N=1 it isn’t a disaster If you have some feedback (maybe in a new thread?) that would be interesting to help improve the template.
Hmm, I’ve created an apt.txt fie in my repo containing the line:
libmagick+±dev
But this error pops up when Binder is launched:
Step 49/60 : RUN apt-get -qq update && apt-get install --yes --no-install-recommends libmagick+±dev && apt-get -qq purge && apt-get -qq clean && rm -rf /var/lib/apt/lists/*
—> Running in 49e79e20efcd
Reading package lists…
Building dependency tree…
Reading state information…
E: Unable to locate package libmagick+±dev
E: Couldn’t find any package by regex ‘libmagick+±dev’
Which makes me thing I’m supposed to be specifying a path somewhere or need to pass to apt-get something additional/else. I had a look at the latex example for apt.txt but couldn’t figure out how to generalise it to installing magick and rustc.
I think the problem is that discourse mangled the name of the package (the second + symbol has an underline for me or maybe it is meant to be a ±). I am pretty sure the package name doesn’t contain special characters like that and should be ibmagick++-dev. That is two + symbols followed by one -.
Huge thanks, Tim! This has worked perfectly! If you launch my Binder:
and then run the animation_code.R script you will see a data visualisation involving animated train png images demonstrating the running total of delayed international train departures of SNCF (from an old Tidy Tuesday dataset).