Skip to content

Shinylive-R embedded in Quarto not rendering without R in PATH #64

@kv9898

Description

@kv9898

I was asked to file it here by the Quarto team (quarto-dev/quarto#557).

System details:

Windows 11 64-bit

Version details:

Positron Version: 2024.09.0 (system setup) build 77
Code - OSS Version: 1.93.0
Date: 2024-09-23T02:44:07.418Z
Electron: 30.4.0
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Quarto: 1.6.15
shinylive (R package): 0.2.0

Interpreter details:

R 4.4.1

Describe the issue:

Seems to be a Windows only issue.

In a nutshell, without R in PATH for Windows:

  • Positron/VS Code + Quarto + Shinylive + R = ×
  • Positron/VS Code + Quarto + Shinylive + Python = √
  • RStudio + Quarto + Shinylive + R = √
  • Positron/VS Code + Shiny + R = √

Steps to reproduce the issue:

  1. No R in PATH (default setting for Windows)
  2. Start a new folder for the Quarto project
  3. Open the folder in Positron/VS Code
  4. Execute quarto add quarto-ext/shinylive in Terminal to install the Quarto extension.
  5. Run install.packages("shinylive") if it has not been installed before.
  6. Start a .qmd file
  7. Include the following minimum quarto document, and render:
---
title: "Shinylive R test"
filters:
  - shinylive
---
```{shinylive-r}
#| standalone: true

```
  1. You get an error.

Expected or desired behavior:

Running normally as in RStudio.
image

From RStudio Background Jobs:

==> quarto preview shinyliver.qmd --to default --no-watch-inputs --no-browse

pandoc 
  to: html
  output-file: shinyliver.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: Shinylive R test
  
ℹ Loading metadata database
✔ Loading metadata database ... done

Output created: shinyliver.html

Watching files for changes
Browse at http://localhost:5239/

Were there any error messages in the UI, Output panel, or Developer Tools console?

From Positron/VS Code Terminal:

PS D:\OneDrive - London School of Economics\Desktop\shinyliveRError> quarto preview "d:/OneDrive - London School of Economics/Desktop/shinyliveRError/shinyliver.qmd" --no-browser --no-watch-inputs
pandoc 
  to: html
  output-file: shinyliver.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png
  
metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: Shinylive R test

(E) Error running 'Rscript' command. Perhaps you need to install / update the 'shinylive' R package?
 Error:
 PandocError {}
Error running filter D:/quarto/share/filters/main.lua:
...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:40: Error running 'Rscript' command. Perhaps you need to install / update the 'shinylive' R package?

stack traceback:
        ...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:40: in global 'throw_quarto_error'
        ...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:86: in global 'callRShinylive'
        ...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:113: in global 'callShinylive'
        ...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:286: in global 'ensureBaseSetup'
        ...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:315: in global 'ensureLanguageSetup'
        ...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:424: in function <...iveRError\_extensions\quarto-ext\shinylive\shinylive.lua:408>        
        [C]: in ?
        [C]: in method 'walk'
        D:/quarto/share/filters/main.lua:558: in local 'checked_walk'
        D:/quarto/share/filters/main.lua:610: in function 'run_emulated_filter'
        D:/quarto/share/filters/main.lua:1335: in local 'callback'
        [string "..."]:1888: in field 'withScriptFile'
        D:/quarto/share/filters/main.lua:1351: in upvalue 'run_emulated_filter_chain'
        D:/quarto/share/filters/main.lua:1389: in function <D:/quarto/share/filters/main.lua:1386>
stack traceback:
        D:/quarto/share/filters/main.lua:558: in local 'checked_walk'
        D:/quarto/share/filters/main.lua:610: in function 'run_emulated_filter'
        D:/quarto/share/filters/main.lua:1335: in local 'callback'
        [string "..."]:1888: in field 'withScriptFile'
        D:/quarto/share/filters/main.lua:1351: in upvalue 'run_emulated_filter_chain'
        D:/quarto/share/filters/main.lua:1389: in function <D:/quarto/share/filters/main.lua:1386>

This error is misleading since it tells the user to (re)install the shinylive R package, whereas what the user really needs to to is to put R in PATH/the lua should detect R in other ways.

@jennybc points out in quarto-dev/quarto#557 (comment) that:

I can speak to the Positron + Windows part of this. By default, the CRAN R installer for Windows does not put R on the PATH. Therefore R installation discovery focuses on well-known places and learning from the registry instead. Most Windows users will not have R on the PATH, so a naked call to R or Rscript is going to fail.

@cscheid thinks this leads to a problem (quarto-dev/quarto#557 (comment)) given

res = pandoc.pipe("Rscript", args, input)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions