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

rocker/rstudio for apple silicon linux/arm64/v8 platform #144

Closed
dvillaj opened this issue Apr 16, 2021 · 46 comments · Fixed by #651 or UCSF-DSCOLAB/hackathon_primer#1
Closed

rocker/rstudio for apple silicon linux/arm64/v8 platform #144

dvillaj opened this issue Apr 16, 2021 · 46 comments · Fixed by #651 or UCSF-DSCOLAB/hackathon_primer#1
Labels
enhancement New feature or request pre-built images Related to pre-built images

Comments

@dvillaj
Copy link

dvillaj commented Apr 16, 2021

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

Screenshot 2021-04-16 at 05 20 29

When I try to log-in in RStudio I get the following error: Error: Incorrect or invalid username/password

Screenshot 2021-04-16 at 05 32 38.

I have tried with the latest version of Docker Desktop (3.3.1) and disabling/enabled experimental features.

@style206

This comment was marked as duplicate.

@eitsupi
Copy link
Member

eitsupi commented Jun 22, 2021

See this issue for arm64 build of RStudio.
rstudio/rstudio#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...

@eitsupi

This comment was marked as outdated.

@echuber2
Copy link

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

@eitsupi eitsupi pinned this issue Feb 19, 2022
@eitsupi eitsupi changed the title support for apple silicon linux/arm64/v8 platform rocker/rstudio for apple silicon linux/arm64/v8 platform Apr 3, 2022
@eitsupi eitsupi added enhancement New feature or request help wanted Extra attention is needed labels Apr 3, 2022
@eitsupi
Copy link
Member

eitsupi commented Jun 23, 2022

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

@eitsupi

This comment was marked as outdated.

@eitsupi
Copy link
Member

eitsupi commented Aug 23, 2022

The arm64 version of RStudio daily builds are now available for focal (rstudio/rstudio#8809 (comment)).
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"]

image

@yufree
Copy link

yufree commented Aug 28, 2022

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.

@benz0li

This comment was marked as resolved.

@benz0li

This comment was marked as resolved.

@eitsupi
Copy link
Member

eitsupi commented Aug 29, 2022

@yufree
Thanks for sharing the example Dockerfile, as @benz0li pointed out, currently install_tidyverse.sh and install_quarto.sh cannot run on arm64.

  1. Cannot build the duckdb package on arm64 platform due to R problem (will be fixed in R 4.3.0)
  2. 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 that install_tidyverse.sh lacks cmake installation, so older arrow versions try to install the amd64 version of cmake even on arm64.
  3. 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.
#312 (comment)

@Dschaykib

This comment was marked as off-topic.

@eitsupi

This comment was marked as off-topic.

@Dschaykib

This comment was marked as off-topic.

@eitsupi

This comment was marked as off-topic.

@chendaniely
Copy link

chendaniely commented Feb 1, 2023

I can confirm that the solution from @nikdata works. Tested this out with a few students in a class I'm teaching.
There's a few things you need to do to get it working:

  1. Get the latest version of docker desktop
  2. You need to update OSX to Ventura 13+ (anything older won't work)
  3. Enable rosetta from command line: softwareupdate --install-rosetta

Then you will see the checkbox under the experimental settings (settings > features in development > use rosetta)

Run the image:

docker run --rm \
  -p 127.0.0.1:8787:8787 \
  -e DISABLE_AUTH=true \
  rocker/rstudio

Because it's doing things through Rosetta. I haven't confirmed how packages and installations + compiling are handled. 🤞

edit (2 weeks later): you can swap out rocker/rstudio for rocker/tidyverse it'll save you a RUN command later. Also I found out that you need to specify :4.1.3, at the moment the 4.2 and :latest tags don't seem to work

docker run --rm \
  -p 127.0.0.1:8787:8787 \
  -e DISABLE_AUTH=true \
  rocker/tidyverse:4.1.3

FWIW I installed and ran some rstan stuff. and the example stuff worked. So it seems that any of the compiled stuff within the container should work as normal.

@Martins6
Copy link

Martins6 commented Feb 7, 2023

I'm using Mac with M2 chip. You guys helped a lot as well, thanks!

Just to complement the answer from @chendaniely, I had to specify the platform argument as well. The final results is the following to make it work, hope it helps someone!

docker run --rm \
  --platform linux/x86_64 \
  -p 8787:8787 \
  -e PASSWORD=YOURNEWPASSWORD \
  -e DISABLE_AUTH=true \
  rocker/rstudio

@AdamCiuris
Copy link

I can confirm that the solution from @nikdata works. Tested this out with a few students in a class I'm teaching. There's a few things you need to do to get it working:

  1. Get the latest version of docker desktop
  2. You need to update OSX to Ventura 13+ (anything older won't work)
  3. Enable rosetta from command line: softwareupdate --install-rosetta

Then you will see the checkbox under the experimental settings.

Run the image:

docker run --rm \
  -p 127.0.0.1:8787:8787 \
  -e DISABLE_AUTH=true \
  rocker/rstudio

Because it's doing things through Rosetta. I haven't confirmed how packages and installations + compiling are handled. 🤞

Thank you! We spent two days on this and this fixed it. Remember to update docker and tick the two settings in docker desktop that let you use rosetta!

@hughcross
Copy link

Thanks to everyone for their input and testing. I have not updated to Ventura yet (work computer, so have to go by their schedule), but once I do I will check this out.

pdurbin added a commit to pdurbin/notice that referenced this issue Feb 12, 2023
In addition, get it working on Podman.

Discussion of the Apple silicon M1/M2 arm64 chip:
rocker-org/rocker-versioned2#144
@SameOldSamOld
Copy link

This thread has been extremely useful for me on my Apple M2. Thank you very much.

Below is the fix that finally helped me build my Dockerfile successfully!

docker build --platform linux/x86_64 -t my_container:1.0 .

@chendaniely
Copy link

chendaniely commented Feb 16, 2023

I edited my original comment. It seems that for many of my students and me, we need to use :4.1.3 right now.

Try that version if :latest or :4.2.2 isn't working.

Maybe that's what the platform tag fixed 🤷

@eitsupi
Copy link
Member

eitsupi commented Feb 17, 2023

FYI, Quarto CLI 1.3 releases (now prerelease) include deb packages for arm64, so we will probably be able to build rocker/rstudio for arm64 in its complete form soon.

@eitsupi
Copy link
Member

eitsupi commented May 13, 2023

I have created a PR #651 to enable arm64 builds of rocker/rstudio with RStudio 2023.05.1 or later.
Ref: rstudio/rstudio#12411

@eitsupi eitsupi added pre-built images Related to pre-built images and removed help wanted Extra attention is needed labels May 13, 2023
@diazrenata
Copy link

Thank you, @eitsupi, for incredible work on this (going back years)! I understand if this may not be possible, but I am wondering if it would be feasible to release versions of rocker/tidyverse that are also arm64 compatible? It would be incredibly helpful, but I completely understand if either time or the upstream dependencies and build times are prohibitive!

@eitsupi
Copy link
Member

eitsupi commented May 16, 2023

Thanks @diazrenata.
As you understand, the rocker/tidyverse takes a tremendous amount of time to build the arrow and duckdb packages, and I expect that the current workflow as is will probably not be able to build them stably due to the 360 minute GitHub Actions limit with arm64 emulation.
It might be possible to build if the current workflow (which builds all images that depend on rocker/r-ver) is split into multiple parts to get around the 360 minute limit.

If the Posit Package Manager starts supporting binary installation of arm64 Ubuntu, it could make it easier to build.
(I believe @glin mentioned somewhere that they were considering this.)

eitsupi added a commit that referenced this issue May 17, 2023
…651)

Close #144

Currently the linux/arm64 platform version of RStudio IDE is not bundled
Quarto CLI, but bundling may begin after RStudio IDE 2023.05.0.
(rstudio/rstudio#12411, rstudio/rstudio#13127)

When the Quarto CLI bundle to the RStudio IDE is started, I think we can
start building arm64 version of `rocker/rstudio`.

This PR also includes a small refactoring to correspond to the recently
released purrr 1.0.0. (Close #595)
@eitsupi
Copy link
Member

eitsupi commented Jun 9, 2023

rocker/rstudio:latest arm64 image has been pushed to DockerHub today.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pre-built images Related to pre-built images
Projects
None yet