webr icon indicating copy to clipboard operation
webr copied to clipboard

Where can we get a list of available packages that can be installed with webR?

Open AdrianAntico opened this issue 1 year ago • 9 comments

The docs mentioned, "If the package is available for webR and can be installed..."

Is there a list of supported packages? Can github packages be installed?

AdrianAntico avatar Aug 16 '23 16:08 AdrianAntico

On a slightly different topic, If a package isn't already supported by webR, I'd love to know if there's a way or guide to make it so that I can work on getting it supported by webR!

Thanks !

jhk0530 avatar Aug 17 '23 10:08 jhk0530

I'd like to second @jhk0530's comment; would love a guide on how to make a package compatible with WebR (even if it's likely to change in the future).

WillemSleegers avatar Aug 18 '23 08:08 WillemSleegers

Also, I'm pretty sure here's the list of supported packages: https://github.com/r-wasm/webr-repo/blob/main/repo-packages

WillemSleegers avatar Aug 18 '23 08:08 WillemSleegers

Can github packages be installed?

No, R packages with compiled code must be compiled for Wasm, which requires a WebAssembly and webR development environment. This is not currently possible in a web browser alone.

Is there a list of supported packages?

The webR public repo now provides more Wasm R packages than in the list above. A full table can be found at https://repo.r-wasm.org/. Note that the list of packages might take a while to load the first time you visit the page, it is loading webR and a Shiny app.

If a package isn't already supported by webR, I'd love to know if there's a way or guide to make it so

There is not yet any detailed documentation covering how to build R packages for WebAssembly and webR, but it is something I'd definitely like to provide. It will not be a short guide, there are many subtleties with building R packages for Wasm, even with the excellent Emscripten compiler suite making things work as smoothly as possible for C/C++ code. R package code often needs patches to work in the limited environment provided by the WebAssembly VM.

After the next planned future patch release of webR (v0.2.1), I should be able to begin work on writing package-building documentation. Hopefully, later this year if all goes to plan.

georgestagg avatar Aug 23 '23 08:08 georgestagg

Extending #262, it might be interesting to also shim available.packages

Screenshot 2023-09-04 at 10 51 51

ColinFay avatar Sep 04 '23 08:09 ColinFay

I don't think shimming is required here. Right now, you can use

available.packages(repos=getOption("webr_pkg_repos"))

As shown in above command, an option setting the default webR package repo exists but is namespaced. Currently, webR does not touch options("repos"), but it could do so. If it did, I think available.packages() would work out-of-the-box without shimming.

I am unsure if webR should make such a change to the existing repos option or not, I could probably be convinced either way.

georgestagg avatar Sep 04 '23 09:09 georgestagg

I would definitely vote for having the default repo set without the user having to change it — my view being that if you need to do it every time, then it should be the default?

I mean, in 99% of cases (maybe more) you'd want available.packages() to look on the webR repo, so it would be a better use experience (imo)

ColinFay avatar Sep 04 '23 09:09 ColinFay

right now we can install a single package and hope the right version is provided, like: webr::install("ggplot2")

is there a way to specify a version too? https://repo.r-wasm.org/bin/emscripten/contrib/4.3/ggplot2_3.4.4.tgz https://repo.r-wasm.org/bin/emscripten/contrib/4.3/ggplot2_3.4.3.tgz

are both valid.

bugzpodder avatar Oct 27 '23 20:10 bugzpodder

is there a way to specify a version too?

Not right now, no. The webR binary repo at repo.r-wasm.org only concerns itself with the latest version of packages. The scripts just don't delete the older packages previously uploaded, which is why you can still grab them.

In principle you could use webR to download.file() the older file and untar() it into /usr/lib/R/library on the virtual filesystem, but it will be a manual process, and I can't guarantee the older packages will always be available going forward.

I'm currently building an R package that will run with a native R installation to help curate your own webR binary repos by building Wasm packages from source, which could then be hosted on static file services such as GitHub Pages. Once this has been released and well documented, you'll be able to create your own binary repos containing older versions of packages if required.

georgestagg avatar Oct 30 '23 13:10 georgestagg