quarto-ext / shinylive

Quarto extension to embed Shinylive for Python applications
https://quarto-ext.github.io/shinylive/
MIT License
150 stars 8 forks source link

error from new Quarto: Specifier not found in cache #65

Open kv9898 opened 1 month ago

kv9898 commented 1 month ago

For later versions of Quarto (1.6.19 onwards), I got an error which is not present in early versions (1.6.18 and before):

error: Specifier not found in cache: "https://deno.land/std/io/mod.ts", --cached-only is specified.
    at file:///C:/Users/kv989/AppData/Local/shinylive/shinylive/Cache/shinylive-0.7.0/scripts/codeblock-to-json.js:5:27      
Error running filter D:/quarto/share/filters/main.lua:
Error running D:\quarto\bin\quarto.exe (error code 1): <no output>
stack traceback:
        D:\website\_extensions\quarto-ext\shinylive\shinylive.lua:427: in function <D:\website\_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>

quarto check information with the last working version of Quarto (1.6.18):

Quarto 1.6.18
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.6.18
      Path: D:\quarto\bin
      CodePage: 936

[>] Checking tools....................OK
      TinyTeX: v2024.09
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\kv989\AppData\Roaming\TinyTeX\bin\windows\
      Version: 2024

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.12.4 (Conda)
      Path: D:/Anaconda/python.exe
      Jupyter: 5.7.2
      Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.4.1
      Path: D:/R-4.4.1
      LibPaths:
        - D:/R-4.4.1/library
      knitr: 1.48
      rmarkdown: 2.28

[>] Checking Knitr engine render......OK
kv9898 commented 1 month ago

Note: a Windows laptop is used. The quarto extension and python library of Shinylive are up to date

kv9898 commented 1 month ago

The Quarto side suggests Shinylive update its script: https://github.com/quarto-dev/quarto-cli/issues/11183#issuecomment-2435662392

cderv commented 4 weeks ago

Quarto 1.6 does have breaking change with quarto run: prerelease doc has the updated information https://prerelease.quarto.org/docs/projects/scripts.html#deno-scripts

kv9898 commented 4 weeks ago

Quarto 1.6 does have breaking change with quarto run: prerelease doc has the updated information https://prerelease.quarto.org/docs/projects/scripts.html#deno-scripts

Thanks for the information. I tried to do a quick fix to bug following the documentation by changing:

import { readLines } from "https://deno.land/std/io/mod.ts";

to:

import { readLines } from "stdlib/io";

and a new error pops up:

error: JSR package version manifest for '@std/io@0.224.9' failed to load: Specifier not found in cache: "https://jsr.io/@std/io/0.224.9_meta.json", --cached-only is specified.
    at file:///C:/Users/kv989/AppData/Local/shinylive/shinylive/Cache/shinylive-0.7.0/scripts/codeblock-to-json.js:5:27
Error running filter D:/quarto/share/filters/main.lua:

Any ideas?

cderv commented 3 weeks ago

Something does not seem right... 🤔 I'll dig into that, as I don't think it is related to shinylive.

Edit: It seems we have an issue and this is tracked in

Thanks for reporting !

kv9898 commented 3 weeks ago

Something does not seem right... 🤔 I'll dig into that, as I don't think it is related to shinylive.

Edit: It seems we have an issue and this is tracked in

Thanks for reporting !

Thank you so much for looking into this. Good to know that both projects belong to Posit and we have someone like you who have worked on both projects.

cderv commented 3 weeks ago

This should be fixed in 1.6.32. You can try again with shinylive and updated scripts.

kv9898 commented 3 weeks ago

It worked! Thank you. Shall I keep this issue open for the Shinylive script to be edited? I'm hesitating to write a PR now as I fear the updated script would break support for Quarto 1.5, which is the current stable release?

cderv commented 3 weeks ago

I'm hesitating to write a PR now as I fear the updated script would break support for Quarto 1.5, which is the current stable release?

Yes something needs to be done regarding that... maybe it requires two scripts and use the correct one based on quarto version used ?

You could probably open a PR with ideas, otherwise we'll come with a solution soon.

kv9898 commented 3 weeks ago

I'm hesitating to write a PR now as I fear the updated script would break support for Quarto 1.5, which is the current stable release?

Yes something needs to be done regarding that... maybe it requires two scripts and use the correct one based on quarto version used ?

You could probably open a PR with ideas, otherwise we'll come with a solution soon.

It seems that the source is in a different repo: https://github.com/posit-dev/shinylive/blob/6e4933f46048f3b0d1293d31e9525570b0c4ff94/src/scripts/codeblock-to-json.ts

I opened an issue there: https://github.com/posit-dev/shinylive/issues/185

That repo does not seem very active, though. My previous issue posted 1 month ago hasn't got any replies yet.