-
Notifications
You must be signed in to change notification settings - Fork 240
Description
When running learnr documents simple plots (e.g. plot(1:10)) time out in exercise chunks under the following conditions:
- rocker/rstudio versions >=4.4.2 (4.4.1 and below work fine)
- document contains a plot
- there is no .html file existing from a previous render (if the html file exists, there's no problem)
- attempt to plot something in the exercise chunk (other code works fine, just plotting gets stuck)
We have seen this on multiple platforms using different docker images based on rocker/rstudio
Reprex
---
title: "test-plots"
output: learnr::tutorial
runtime: shiny_prerendered
---
```{r setup, include=FALSE}
library(learnr)
knitr::opts_chunk$set(echo = FALSE)
```
## Plot Data
### Plot run by document
```{r, echo=TRUE}
plot(1:10)
```
### Plot exercise
```{r freeplay-exercise, exercise=TRUE, exercise.eval=FALSE}
```
Steps to reproduce
- Run container based on rocker/rstudio (and install learnr + dependencies as needed)
- Open tutorial .Rmd and click "Run Document"
- Try to create a plot using the exercise chunk.
Docker Details
rocker/rstudio needs a few dependencies to get learnr running, and I had to add zlib1g-dev to get them to compile, so in order to test things out locally I did the following:
- Built new docker image, that only adds zlib1g-dev:
Dockerfile:
FROM rocker/rstudio:4.4.2
RUN apt-get update && apt-get install -y zlib1g-dev
- Started up the container and ran install.packages(“learnr”)
- Clicked "Run Document", and said yes when prompted to install stringi, stringr
- Clicked "Run Document", and it hangs on plotting the first time it runs, succeeds the second (and hangs again if I delete the .html file)
If I do exactly the same setup but use rocker/rstudio:4.4.1 instead of 4.4.2, then plotting works fine.
Got any ideas what might be going on? I realize rocker/rstudio is fairly complex and is not directly related to learnr, but it's a pretty popular image and is useful for getting student set up to work in cloud environments.
I'm also not sure where/how I could see more informative error messages; learnr doesn't print anything to the RStudio console, so I'm feeling a bit stuck as to how I could try to track this down.