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

TMB fails under Web R: "cannot open the connection [...] /usr/lib/R/library/TMB/Matrix-version" #392

Closed
adrianolszewski opened this issue Mar 26, 2024 · 5 comments

Comments

@adrianolszewski
Copy link

Hello,
Is it possible to change the code of TMB to fix the problem it causes under the Web R (webassembly)? Web R allows one to run R code just within the web browser, without calling any external server.

The issue makes also all dependent packages, like mmrm (core package to analyze longitudinal data in clinicaltrials), unable to load under Web R.

Related issue: r-wasm/webr#386

Description:

When the library is loaded under web r, it raises the following error:
obraz

Reproducible Steps:

Please visit: https://webr.r-wasm.org/latest/

Type "library(TMB)" and choose to install it (1).

It will fail:

R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: wasm32-unknown-emscripten (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.

> library(TMB)
Failed to load package "TMB". Do you want to try downloading it from the webR binary repo? 

1: Yes
2: No

Selection: 1
Downloading webR package: lattice
Downloading webR package: Matrix
Downloading webR package: Rcpp
Downloading webR package: RcppEigen
Downloading webR package: TMB
Error: package or namespace load failed for ‘TMB’:
 .onLoad failed in loadNamespace() for 'TMB', details:
  call: file(con, "w")
  error: cannot open the connection
In addition: Warning message:
cannot open file '/usr/lib/R/library/TMB/Matrix-version': Operation not permitted 
> 

Current Output:

Error: package or namespace load failed for ‘TMB’:
 .onLoad failed in loadNamespace() for 'TMB', details:
  call: file(con, "w")
  error: cannot open the connection
In addition: Warning message:
cannot open file '/usr/lib/R/library/TMB/Matrix-version': Operation not permitted 

Expected Output:

No errors should be thrown. Maybe some warning or a regular print().

TMB Version:

I'm waiting for the response from the Web R creators, but let's assume it's the latest one.

R Version:

4.3.3

Operating System:

Platform: wasm32-unknown-emscripten (32-bit)
Looking at the path it reported (/usr/lib...) I guess these packages are built under some distribution of Linux.

@bbolker
Copy link
Contributor

bbolker commented Mar 26, 2024

I don't know exactly why this is happening, but this might be resolvable by changing the upstream-package-dependency check to be more self-contained along the lines suggested here.

I don't know how the webassembly machinery works (does it take packages from CRAN? From r-universe? From the master/main HEAD on GitHub?), but would be willing to make a pull request along these lines if desired.

Someone who knew more about the internals of webassembly might be able to diagnose the problem better.

@adrianolszewski
Copy link
Author

adrianolszewski commented Mar 26, 2024

Thank you very much! I forwarded your response to the source topic r-wasm/webr#386 (comment)

@kaskr
Copy link
Owner

kaskr commented Mar 27, 2024

I know for sure that TMB did work in webr around 6 months ago. Something regarding write permissions to the package folder has changed in webr since then.

@kaskr
Copy link
Owner

kaskr commented Apr 3, 2024

After CRAN submission (1.9.11), TMB now works again on webr.

@adrianolszewski
Copy link
Author

Thank you very, very much for making it working with webR!
I'm closing the issue.

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

No branches or pull requests

3 participants