r-wasm / jupyterlite-webr-kernel

An R kernel for JupyterLite, based on webR.
https://r-wasm.github.io/jupyterlite-webr-kernel/
MIT License
39 stars 7 forks source link

Installing packages from R-universe fails? #6

Open eitsupi opened 6 months ago

eitsupi commented 6 months ago

I run:

webr::shim_install()
install.packages("prqlr", repos = "https://prql.r-universe.dev")

The error occurs:

Warning message:
URL https://prql.r-universe.dev/bin/emscripten/contrib/4.3/PACKAGES.rds: Download failed. See the Javascript console for further information
Downloading webR package: prqlr

Is this any different from the webR REPL demo? (If so, it would be helpful to have it listed in the documentation)

georgestagg commented 6 months ago

I think what is happening is that r-universe is now building Wasm R packages for R 4.4.0, but the Jupyterlite kernel is still running R 4.3 because we have not yet released a stable version of webR based on R 4.4.0.

The REPL at https://webr.r-wasm.org/latest/ runs the latest dev build from the main branch, so it does not have this issue.

Once the next version of webR is released on npm, I'll update this jupyterlite kernel at the same time and the problem should go away.

eitsupi commented 6 months ago

Thanks for your response! R-universe seems to have two builds, one for R4.3 and one for R4.4.

image

In addition, the URL displayed in the error message does not seem to exist for R4.4 either. https://prql.r-universe.dev/bin/emscripten/contrib/4.3/PACKAGES.rds https://prql.r-universe.dev/bin/emscripten/contrib/4.4/PACKAGES.rds

Based on the above, it is possible that the repository on R-universe may not be correctly referenced.

georgestagg commented 6 months ago

Ah, you are right! My mistake, r-universe is indeed also building prqlr for R4.3.

I see what is happening now. R-universe doesn't seem to provide the file PACKAGES.rds, but it does provide PACKAGES. See for example,

https://prql.r-universe.dev/bin/emscripten/contrib/4.4/PACKAGES

When installing the package R first tries the PACKAGES.rds URL. After that fails and prints an error message, it then tries again with PACKAGES.gz, which then succeeds. The message

Downloading webR package: prqlr

indicates that the package installation was successful in the end. You should be able to use prqlr despite the warning message about the failing URL.

Screenshot 2024-05-13 at 12 47 58

EDIT: This is not an ideal warning message. In the webR REPL app, you can see the 404 error in the JavaScript console log, but no Warning message is emitted on the console. I will see if this behaviour can also be replicated here.

eitsupi commented 6 months ago

Thanks for the detailed explanation, I can confirm that the installation was indeed successful. It would be great if the error message could be improved.