Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install packages not available on CRAN? #456

Open
JosiahParry opened this issue Jul 3, 2024 · 6 comments
Open

How to install packages not available on CRAN? #456

JosiahParry opened this issue Jul 3, 2024 · 6 comments
Labels
question Further information is requested

Comments

@JosiahParry
Copy link
Contributor

I'd like to use litedown with webR but running webr::install("litedown") and webr::install("yihui/litedown") both fail saying the package cannot be found.

Any tips here? I suspect the best thing i can do is to build it as part of the {rwasm} build process and mount it.

https://github.com/yihui/litedown

@georgestagg
Copy link
Member

georgestagg commented Jul 3, 2024

Yes, either build the package using {rwasm}, or create a personal r-universe repository (which builds emscripten packages for you automatically using {rwasm}).

Loading packages directly from GitHub using package references such as org/package is not currently supported, because we don't have the necessary toolchain to build the package from source available to us from inside the browser under Wasm.

@JosiahParry
Copy link
Contributor Author

Understandable. The challenge with using r-universe is that (as far as i can tell) it doesn't give us the library.data and library.js.metadata for something locally.

@georgestagg georgestagg added feature New feature or request question Further information is requested and removed feature New feature or request labels Jul 8, 2024
@georgestagg
Copy link
Member

It should be possible to download the .data and .js.metadata files directly from R Universe. The URLs are not exposed directly in the web UI, but the files are built as part of the Wasm cross-compilation process, and live in the same directory as the .tgz file.

e.g.

https://r-lib.r-universe.dev/bin/emscripten/contrib/4.4/cli_3.6.3.9000.data
https://r-lib.r-universe.dev/bin/emscripten/contrib/4.4/cli_3.6.3.9000.js.metadata

@yihui
Copy link

yihui commented Aug 20, 2024

@JosiahParry FYI litedown is on both CRAN and r-universe now.

@psychemedia
Copy link

psychemedia commented Aug 29, 2024

I can successfully load custom built packages using install.packages("mypackage", repos = "https://example.com/myrepo/"), but I wonder, is there an option i can set via options() to set that repos= path?

I also notice that in the JupyterLite webr kernel at least, library(newpackage) pre-emptively tries to install a missing package from the webR repo:

  1. can library() take a repos= style path?
  2. it would be good if we could set a repo path via options() that library() called installations could benefit from.

@georgestagg
Copy link
Member

@psychemedia

is there an option i can set via options() to set that repos= path?

Try setting options("webr_pkg_repos").

IIRC the library() shim that preemptively installs packages should also listen to this option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants