rocker-versioned2
rocker-versioned2 copied to clipboard
`rocker/rstudio` for apple silicon linux/arm64/v8 platform
Hi,
I am experiencing the following error when I try to run the container on a Macbook Pro M1 (MacOS 11.2.3):
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
When I try to log-in in RStudio I get the following error: Error: Incorrect or invalid username/password
.
I have tried with the latest version of Docker Desktop (3.3.1) and disabling/enabled experimental features.
I have the same problem :( I hope that the update supporting M1 Mac.
See this issue for arm64 build of RStudio. https://github.com/rstudio/rstudio/issues/8809
In addition, even if the above issue is resolved and RStudio for arm can be installed, RStudio Package Manager (RSPM) does not provide R binary packages for arm64, so Docker images like rocker/tidyverse
will take a very long time to build...
The upstream issue https://github.com/rstudio/rstudio/issues/8809 appears to have been registered for the 2022-02 (or 2022-03) milestone!
As a stopgap measure, does the amd64 version work (maybe slowly) with Rosetta 2 emulation enabled? We have a version of the rocker image here that has auth turned off for limited usage; reportedly, some people are able to run it on M1 Macs: https://github.com/PrairieLearn/PrairieLearn/tree/master/workspaces/rstudio
Hi, I have noticed that when using rocker/binder
, it is possible to bypass this issue error and run the amd64 version of RStudio Server on arm mac because RStudio Server is run by jupyter-rsession-proxy
.
If you really want to use RStudio Server on arm mac, this workaround may be worth trying.
https://www.rocker-project.org/images/versioned/binder.html
It appears that the arm64 RStudio Server daily build for jammy is now available. (https://github.com/rstudio/rstudio/issues/8809#issuecomment-1218410557)
https://rstudio.org/download/latest/daily/server/jammy/rstudio-server-latest-arm64.deb
I believe this can be installed with the install_rstudio.sh
script, but so far there is no jammy-based, arm64-architecture rocker/r-ver
here, so I have not tried it. (rocker/r-ver:devel
is already jammy but amd64 only)
When R 4.2.2 is released, rocker/r-ver:latest
will be built on ubuntu:jammy
, so we will be able to try this.
https://github.com/rocker-org/rocker-versioned2/blob/ce8821d2090c0a88ca2875582c4946536df67614/scripts/install_rstudio.sh#L60-L61
Note that even after rocker/r-ver:latest
is jammy-based, arm64 builds of rocker/rstudio:latest-daily
will not be possible for a while because quarto cli arm64 does not exist.
(It is hoped that an arm64 runner will appear in GitHub Actions later this year and an arm64 version of deno will be released, which may allow quarto cli to do arm64 builds as well).
https://github.com/rocker-org/rocker-versioned2/blob/ce8821d2090c0a88ca2875582c4946536df67614/dockerfiles/rstudio_latest-daily.Dockerfile#L1-L17
The arm64 version of RStudio daily builds are now available for focal (https://github.com/rstudio/rstudio/issues/8809#issuecomment-1224856044). The following Dockerfile should work on arm64 platforms now!
FROM rocker/r-ver:4.2.1
ENV S6_VERSION=v2.1.0.2
ENV RSTUDIO_VERSION=daily
ENV DEFAULT_USER=rstudio
ENV PANDOC_VERSION=default
ENV PATH=/usr/lib/rstudio-server/bin:$PATH
RUN /rocker_scripts/install_rstudio.sh
RUN /rocker_scripts/install_pandoc.sh
EXPOSE 8787
CMD ["/init"]
Thanks for @eitsupi 's post and now the rocker/rstudio can work on arm64.
However, If I add /rocker_scripts/install_tidyverse.sh
to the dockerfile above, the compile will fail due to two packages ( arrow
and duckdb
) of dplyr database backends. I removed those two packages and add libharfbuzz-dev
libfribidi-dev
libfreetype6-dev
libpng-dev
libtiff5-dev
libjpeg-dev
packages, the tidyverse and verse version can work. I wonder if it's possible to add options to skip certain backends?
Meanwhile, the /rocker_scripts/install_quarto.sh
will also fail.
Here is an example Dockerfile with tidyverse
supported.
However, If I add
/rocker_scripts/install_tidyverse.sh
to the dockerfile above, the compile will fail due to two packages (arrow
andduckdb
) of dplyr database backends.
Will be fixed with the next minor release of R (~~4.2.2~~ 4.3.0) as
*PICFLAGS
~~are now~~ will be set to-fPIC
for aarch64.
– https://github.com/duckdb/duckdb/issues/3049#issuecomment-1207162023
Cross reference: https://bugs.r-project.org/show_bug.cgi?id=18326
Meanwhile, the
/rocker_scripts/install_quarto.sh
will also fail.
RStudio is now has experimental builds for ARM architectures, currently w/o bundled Quarto due to this issue. https://dailies.rstudio.com/rstudio/elsbeth-geranium/server/jammy-arm64/
– https://github.com/quarto-dev/quarto-cli/issues/190#issuecomment-1221008095
Cross reference: https://github.com/denoland/deno/issues/1846
@yufree
Thanks for sharing the example Dockerfile, as @benz0li pointed out, currently install_tidyverse.sh
and install_quarto.sh
cannot run on arm64.
- Cannot build the
duckdb
package on arm64 platform due to R problem (will be fixed in R 4.3.0) - Building the
arrow
package is very hard and cannot be completed on a Raspberry Pi 4 due to machine spec as far as I have tested. There is also a problem thatinstall_tidyverse.sh
lackscmake
installation, so older arrow versions try to install the amd64 version of cmake even on arm64. - quarto cli do not have arm64 builds, so it cannot be installed.
I think we need to document which Rocker scripts are executable on arm64. (#405)
I wonder if it's possible to add options to skip certain backends?
I agree that there is a need to skip arrow and duckdb as they are time consuming or impossible to build. However, since it is up to the user to decide which R packages they wants to install, the option I currently consider promising is to skip installation of all R packages. https://github.com/rocker-org/rocker-versioned2/pull/312#issuecomment-1086858951
@eitsupi I tried your script on two different macs, but in both cases, after the login, I receive an error "unable to connect to service" (the same as mentioned here). Do you have any suggestions on how to fix this or why it happend?
@Dschaykib I have no mac OS machines so I don't know much about it, but make sure you are using a linux/arm64 image. You may be using an amd64 image. https://docs.docker.com/desktop/mac/apple-silicon/#known-issues
I did check and I use the arm64 image. I even included a --platform linux/arm64
flag in the docker build, but I still get the same error.
@Dschaykib Unfortunately, there does not seem to be anything else I can advise you on the basis of the little information you provide.
Probably a stupid question but if I use a container running ubuntu, install docker and then try and use a container rocker/rstudio
in it, would it work?
You can run docker inside docker but that is generally more involved. So in short for what you write above, you would preferably start with the rocker/rstudio container as it already extends (and contains) an underlying container like base ubuntu. So aim at just one.
Hi, recent work (#578 and #584) has made rocker/rstudio:latest-daily
("latest" R plus "daily" build RStudio Server) multi-platform builds for amd64 and arm64.
If you are not afraid of Daily builds, give it a try.
Hi, excellent work with the latest-daily
image. Can I ask when the arm64
will be available also for versioned tags? Thanks!
@gorgitko Thanks for your feedback. I think we can work on it once the arm64 build appears in the stable build of RStudio Server.
@eitsupi Is the same valid for the devel
tag or it could add arm64 support earlier ?
@martin-g The devel tag indicates that the version of R is devel, so the rocker/rstudio:devel
's RStudio version is the stable release version now.
And, rocker/r-ver:devel
does not currently have arm64 builds.
So rocker/rstudio:devel
cannot be built now.
https://hub.docker.com/r/rocker/r-ver/tags - latest
supports arm64
.
Who do we need to ask to add support for arm64
to rocker/r-ver:devel
too ?
Only a simple CI definition file update is required.
Of course we could do that, but we have not done so far because there have been no requests.
Since doing an arm64 build extends the build time of rocker/r-ver
by over an hour, I was hesitant to do that with the devel image builds that we run daily.
I see! Well, count me as the first person to request it! :-)
First of all, major gratitude is in order for the maintainers here. 🙏 This is an incredible project! 🚢 📦
It took me a while to figure out that the rocker/rstudio:latest-daily
was the only image that could run RStudio Server on the Apple M1. Other images with useful packages like rocker/verse:latest-daily
won't run RStudio Server, so if you want to fire up RStudio Server and also use basic packages, the effort to build this image on top of rstudio:latest-daily
falls to the user. I'm building that from scratch right now and can confirm that it takes a while... it would be so cool to just pull rocker/verse:latest-daily
and be able to spin up RStudio Server from it.
As more people start to use Apple M1, it would reduce friction in getting people using RStudio Server in Docker to have compatible builds that just work. I understand that for daily builds, extending build time by > 1 hr slows things down. The question at hand is: is that effort better used by the CI bots, or users who will need to learn the limitations of rocker, and then build their own image?
I'd be happy to submit a PR if pointed to the CI definition files for rstudio:latest-daily
and the files that would need to be changed.
@richpauloo Thanks for the feedback, I'm glad to hear it.
The main issues here are as follows:
- Since RSPM does not provide R binary packages for arm64, all R packages must be built from source. Combined with the slowdown caused by arm64 emulation, this take a very long time.
- The
duckdb
package included ininstall_tidyvese.sh
cannot be installed on arm64 Linux due to a bug in R (expected to be fixed in R 4.3).
In other words, rocker/tidyverse:latest-daily
is currently not buildable.
arm mac can build much faster than GitHub Actions, so you should be able to build it, except for duckdb.
So if we rewrite this script and configure it to skip duckdb on arm64, we should be able to run this script at the user's hand.
https://github.com/rocker-org/rocker-versioned2/blob/23b6961dcc187b7290b35ae4434180dfb1fa7f24/scripts/install_tidyverse.sh#L51
@richpauloo See https://github.com/duckdb/duckdb/issues/3049#issuecomment-1096671708 for a workaround to build duckdb
on aarch64
(arm64
).
As of Docker Desktop for Mac 4.16.2
(or possibly a bit earlier), there is now an option to run amd64
images in Rosetta. This seems to allow older versions (and current versions) of rocker/rstudio
to run without modification. It should also be much faster than the previous emulation.
The option is found in the "Features in development" section of Settings:
@jashapiro
Thank you for the tip. However, I just upgraded Docker Desktop to 4.16.2 and I do not see that option under "Features in development"