REditorSupport / REditorSupport/vscode-R

Kniting to html_document and Knitting to html preview freeze at 0%

Open
#1,277 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

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")
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the freeze with the provided Dockerfile, .devcontainer/devcontainer.json, dependencies.R, and explore Rmd.Rmd, using the R: knit Rmd to HTML and R Markdown: Open Preview commands. Trace the knitting and preview entry points to determine why progress remains at 0%; done means both commands complete and render or preview the document in the dev container.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, r, typescript, vscode
Domain
devtools, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.