vscode-R: Kniting to html_document and Knitting to html preview freeze at 0%

Describe the bug

I have built a VS Code Dev Container for a colleague to explore R in VS Code in order to convince them to replace RStudio. Within the Dev Container, when I use the commands to knit a .Rmd file to .html or to preview the html in another pane, an information window appears that the document is being knit, but it never advances past 0%. See the screenshots.

Screenshot 2022-12-15 065628

Screenshot 2022-12-15 072201

To Reproduce

  1. Install VS Code
  2. Install Docker Desktop - if on Windows (as I am and my colleague) then this will require WSL2 installation and configuration
  3. Create directory for files
  4. Create Dockerfile; provided below
  5. Create .devcontainer/devcontainer.json; provided below
  6. Create dependencies.R; provided below
  7. Create explore Rmd.Rmd; provided below
  8. Open VS code session in directory with files: code <path to directory with files>
  9. Ensure Docker Desktop is running
  10. Rebuild container without cache (takes ~20 minutes to build on my machine)
  11. Navigate to explore Rmd.Rmd within the Dev Container
  12. Run the code chunks and observe output to the radian console
  13. Try to knit the document from the command palette (ctrl/cmd + shift + p -> ‘R: knit Rmd to HTML’)
    • Observe the popup window that it tries to knit but does not proceed past 0%
  14. Try to open the preview of the rendered document from the command palette (ctrl/cmd + shift + p -> ‘R Markdown: Open Preview’)
    • Observe the popup window that it tries to knit but does not proceed past 0%

Can you fix this issue by yourself? (We appreciate the help)

I would like to try to help, but am unsure how to proceed, 😦

Files for reproducing

Dockerfile

FROM r-base:4.2.2

WORKDIR /usr/src

COPY . .

RUN \
    apt-get update && \
    apt-get install -y \
        python3 \
        python3-pip \
        libxml2-dev \
       libfontconfig1-dev \
       libcurl4-openssl-dev \
       libssl-dev \
       pandoc \
       libharfbuzz-dev \
       libfribidi-dev \
       libfreetype6-dev \
       libpng-dev \
       libtiff5-dev \
       libjpeg-dev \
    && \
    Rscript dependencies.R && \
    pip3 install -U radian && \
    echo "alias r=radian" >> /etc/bash.bashrc

CMD [""]

.devcontainer/devcontainer.json

{
	"name": "Existing Dockerfile",
	"context": "..",
	"dockerFile": "../Dockerfile",
	"extensions": [
		 "REditorSupport.r",
		 "ms-vscode.live-server",
	],
	"settings": {
		"[r]": {
			"editor.formatOnType": true,
			"editor.formatOnSave": true,
			"editor.formatOnPaste": true,
			"editor.defaultFormatter": "REditorSupport.r"
		},
		"r.bracketedPaste": true,
		"r.plot.useHttpgd": true,
		"files.associations": {
			"*.Rmd": "rmd"
		}
	}
}

dependencies.R

cores_to_use <- max(parallel::detectCores() - 2, 1)

install.packages("remotes", Ncpus = cores_to_use)

packages <- c(
   "languageserver" = "0.3.14",
   "tidyr" = "1.2.1",
   "httpgd" = "1.3.0",
   "ggplot2" = "3.4.0",
   "plotly" = "4.10.1",
   "shiny" = "1.7.3",
   "rmarkdown" = "2.18"
)

for (pkg in names(packages)) {
   remotes::install_version(pkg, packages[pkg], Ncpus = cores_to_use)
}

explore Rmd.Rmd

# Section 1

## Subsection 1.1

# Editing R Markdown
```{r}
m <- lm(mpg ~ ., data = mtcars)
summary(m)
```

```{r chunk-1}
x <- rnorm(100)
y <- rnorm(100)
```

```{r plot1}
plot(rnorm(100))
abline(h = 0, col = "red")
```

```{r plot2}
plot(rnorm(100))
abline(h = 0, col = "green")
```

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I will try, thank you.