r-wasm / rwasm

Build R packages for WebAssembly and create a CRAN-like repo for distribution.
https://r-wasm.github.io/rwasm/
Other
54 stars 4 forks source link

R not found in the Docker #22

Closed gitdemont closed 2 months ago

gitdemont commented 6 months ago

Hello,

Those days, I tried to make my own packages-built. So I followed instructions from https://r-wasm.github.io/rwasm/articles/rwasm.html and try the Docker container Basically, to get the image, with Windows Powershell, I run

docker pull ghcr.io/r-wasm/webr:main

And then, launch it

docker run -it --rm ghcr.io/r-wasm/webr:main R

I am getting ERROR: R_HOME ('/opt/R/4.3.2/lib/R') not found

Is there something I missed ? (I also try with latest docker pull ghcr.io/r-wasm/webr:v0.3.0-rc.0, and got same error) Should I use the Dockerfile, to update an existing r-base image ? Do you have detailed instructions ?

Best,

georgestagg commented 6 months ago

Hi,

Sorry about this, the tools have not yet been well-tested on Windows or in Powershell. Do you have access to a Linux machine or VM to try, or perhaps you could try with Windows WSL?

One option that might help could be to try starting the container with no argument, before launching R from bash:

$ docker run -it --rm ghcr.io/r-wasm/webr:v0.3.0-rc.0
root@89321b7f0ebe:~# R

R version 4.3.2 (2023-10-31) -- "Eye Holes"
[...]
> 

For reference, I see the following with the v0.3.0-rc.0 container on macOS.

$ docker pull ghcr.io/r-wasm/webr:v0.3.0-rc.0
v0.3.0-rc.0: Pulling from r-wasm/webr
Digest: sha256:04b2d87b4156de14c4df167e0ee2685e0890eb984b87afb3769ccd6dd415faee
Status: Image is up to date for ghcr.io/r-wasm/webr:v0.3.0-rc.0
ghcr.io/r-wasm/webr:v0.3.0-rc.0

$ docker run -it --rm ghcr.io/r-wasm/webr:v0.3.0-rc.0 R
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
[...]
> 
gitdemont commented 6 months ago

Thanks for the quick reply.

Unfortunately, running R afterwards does not help

docker run -it --rm ghcr.io/r-wasm/webr:v0.3.0-rc.0
root@6fd97da70da6:~# R
ERROR: R_HOME ('/opt/R/4.3.2/lib/R') not found

Docker Desktop is installed on my machine and when it launches it starts Windows WSL to run containers (not a pro with docker so I may say wrong). And directly running the webr image in it (i.e. without PowerShell) leads to same error.

In addition, just to give some reassurance, I can launch old rocker image pulled formerly and get R to work (note linux the platform)

#R

R version 4.1.3 (2022-03-10) -- "One Push-Up"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
georgestagg commented 6 months ago

Thank you for reporting back. Yes, I agree and can see your machine is running containers in a Linux VM. I will spin up a Linux machine and continue to investigate.

Out of interest, does the older v0.2.2 image work for you?

docker run -it --rm ghcr.io/r-wasm/webr:v0.2.2 R
gitdemont commented 6 months ago

Thanks !

All the following gave same reported error: For the older 0.2.2, the :latest I tested some times ago, around 1 month (deleted it since). The :main, "Created": "2024-03-11T21:26:11.19711499Z", I tried recently, I think, was still a v0.2.2 The newest :v0.3.0-rc.0 "Created": "2024-03-13T16:25:10.382287235Z", was v0.3.0

georgestagg commented 6 months ago

Unable to reproduce on a Linux-based test machine, Ubuntu 22.04.3 LTS.

georgestagg@runner:~$ docker run -it --rm ghcr.io/r-wasm/webr:v0.3.0-rc.0 R

R version 4.3.2 (2023-10-31) -- "Eye Holes"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Additional info:

georgestagg@runner:~$ docker inspect -f '{{ .Created }}' ghcr.io/r-wasm/webr:main
2024-03-11T21:26:11.19711499Z
georgestagg@runner:~$ docker inspect -f '{{ .Created }}' ghcr.io/r-wasm/webr:v0.3.0-rc.0
2024-03-13T16:25:10.382287235Z
georgestagg@runner:~$ docker images
REPOSITORY                        TAG           IMAGE ID       CREATED        SIZE
ghcr.io/r-wasm/webr               v0.3.0-rc.0   ee45e9428545   19 hours ago   3.81GB
ghcr.io/r-wasm/webr               main          2833b5531f57   2 days ago     3.76GB

Will continue to investigate and will post further updates to the thread if I find anything.

gitdemont commented 5 months ago

Hi, I just tried to build the image directly from the Dockerfile in the webr repo on my windows machine. But unfortunately it failed with the following error:

 => [internal] load build definition from Dockerfile                                                               
 => => transferring dockerfile: 3.93kB                                                                             
 => [internal] load .dockerignore                                                                                  
 => => transferring context: 2B                                                                                    
 => [internal] load metadata for ghcr.io/r-wasm/flang-wasm:main                                                    
 => [webr 1/1] FROM ghcr.io/r-wasm/flang-wasm:main@sha256:7110a10f44d17cf929376817a7167ed4ba9b7b96327acfebce45f    
 => => resolve ghcr.io/r-wasm/flang-wasm:main@sha256:7110a10f44d17cf929376817a7167ed4ba9b7b96327acfebce45fc4adc9f  
 => => sha256:7110a10f44d17cf929376817a7167ed4ba9b7b96327acfebce45fc4adc9f789c 742B / 742B                         
 => => sha256:55c20506c5ac2684e8924a2070604c443ae2b8776f29b4e658ea314ac2dda478 2.30kB / 2.30kB                     
 => => sha256:d66d6a6a368713979f9d00fad193991ae1af18b8efd3abf4d70ade192807c1bd 30.45MB / 30.45MB                   
 => => sha256:47c833c686e14c89955acc4a1731bd944c93c37114829e85bb8ad24303bf0f30 629.36MB / 629.36MB                 
 => => extracting sha256:d66d6a6a368713979f9d00fad193991ae1af18b8efd3abf4d70ade192807c1bd                          
 => => extracting sha256:47c833c686e14c89955acc4a1731bd944c93c37114829e85bb8ad24303bf0f30                          
 => CANCELED [deb_build 1/1] RUN mkdir /opt/fake_rust/ &&     apt-get update &&  apt-get install -y equivs lsb-re  
 => ERROR [scratch 1/16] RUN mkdir -p /etc/apt/keyrings &&     curl -fsSL https://deb.nodesource.com/gpgkey/nodes  
------
 > [scratch 1/16] RUN mkdir -p /etc/apt/keyrings &&     curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key |     gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg &&     echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg]         https://deb.nodesource.com/node_18.x nodistro main" |     tee /etc/apt/sources.list.d/nodesource.list &&     apt-get update &&     apt-get install nodejs -y:
#5 0.421 curl: (6) getaddrinfo() thread failed to start
#5 0.421 gpg: no valid OpenPGP data found.
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/bash -c mkdir -p /etc/apt/keyrings &&     curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key |     gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg &&     echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg]         https://deb.nodesource.com/node_18.x nodistro main" |     tee /etc/apt/sources.list.d/nodesource.list &&     apt-get update &&     apt-get install nodejs -y]: runc did not terminate sucessfully
gitdemont commented 2 months ago

Hi @georgestagg ,

I was able to pull and run latest ghcr.io/r-wasm/webr:v0.4.0-rc.0

I think but can't confirm 100% that the former problems I saw may have come from my side. Because the /etc/apt/keyring and gpg: no valid OpenPGP data found things desappeared with a total fresh re-installation of windows WSL and Docker Deskstop

Thanks for your support !