Build failed: RAM error when compiling rstan

Bug description

Hi, I used the holepunch package to make my repo binder-ready. The binder has been working without problems until recently it failed to build. The build failed when compiling rstan package. The error message is very similar to what is described here and it seems to be a RAM issue.

How to reproduce

  1. Go to my repo:
  2. Click on Launch Binder (takes hours to build).
  3. See error

Do you know how much RAM is required to build rstan? Has this changed recently, e.g. due to a new release?


I actually have no idea how much RAM it takes to build the rstan. I built the Docker image long time ago and it has been running smoothly. Sometimes when I launched the binder, the build started again though there was already a built image. But the build has always been successful. Two days ago, I tried to launch the binder, it started to build again but this time it failed. I tried several times, it’s always the same error which I have never encountered before. Since I have not changed anything in my repo, shouldn’t it just work without problems?

We started to enforce a limit on how much RAM can be used during a build on The limit is (I think) 3GB. I think this enforcement came in maybe a few weeks ago. Before that builds could use a lot more RAM but that was a configuration oversight.

This would explain why it used to work and now doesn’t. A way forward would be to investigate if there are ways to build rstan and use less RAM while doing so.

Thanks for the explaination! I’ll just have to find out which R packages have rstan in the dependencies and hopefully find an alternative R package for my analysis.

Update: the build was successful after I removed ggstatsplot package, which has rstan in its dependencies, from the DESCRIPTION file. I have not found satisfactory alternative package. Hope there’ll be a workaround solution soon.

A couple of things you could try are:

  • see if precompiled r packages are available on conda-forge
  • since you’re using a Dockerfile you could build it yourself and push it to a public registry, then in your binder directory have a minimal Dockerfile with just FROM registry/my-prebuilt-image:tag
1 Like


Following your suggestion, I built the Docker image locally, pushed it to Docker Hub and successfully launched RStudio instance using the pre-built image. When launching the RStudio instance via binder, it was actually A LOT faster (minutes) using the pre-built Docker image than building it in the binder server (hours). I think this will the default way of making my repo binder-ready for my new projects.

Many thanks for the great tips!

1 Like