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

Crosscompiling from amd64 to arm64 on docker throws Error in loadNamespace(x) : there is no package called ‘remotes’ #814

Closed
ConYel opened this issue Oct 21, 2024 · 4 comments

Comments

@ConYel
Copy link

ConYel commented Oct 21, 2024

Hello and thank you for this very useful package.
I am trying to create a docker image for amd64 and arm64 machines (as we need reproducibility between users of the lab).
My laptop is amd64 but with docker there is this possibility to cross-compile.
Unfortunately on the arm64 side I get always the error:

docker buildx build   -f ./Dockerfile   -t local/rstudio_server:v01_r4.3.2   --platform linux/arm64   -o type=tar,dest=rstudio_server_v4.3.2.tar .
[+] Building 5.3s (9/10)                                               docker-container:build
 => [internal] load build definition from Dockerfile                                     0.0s
 => => transferring dockerfile: 4.46kB                                                   0.0s
 => [internal] load metadata for docker.io/rocker/rstudio:4.3.2                          1.1s
 => [internal] load .dockerignore                                                        0.0s
 => => transferring context: 2B                                                          0.0s
 => [internal] load build context                                                        0.0s
 => => transferring context: 77B                                                         0.0s
 => [1/6] FROM docker.io/rocker/rstudio:4.3.2@sha256:2f48314dfffab8ac2e1bc1797b0564b1f9  0.0s
 => => resolve docker.io/rocker/rstudio:4.3.2@sha256:2f48314dfffab8ac2e1bc1797b0564b1f9  0.0s
 => CACHED [2/6] RUN apt-get clean all &&     apt-get update &&     apt-get upgrade -y   0.0s
 => CACHED [3/6] RUN R -e 'install.packages("BiocManager", version = "${BIOCvrs}", lib=  0.0s
 => CACHED [4/6] COPY --chown=rstudio:rstudio ./install_packages.R /home/rstudio/        0.0s
 => ERROR [5/6] RUN Rscript /home/rstudio/install_packages.R                             3.9s
------
 > [5/6] RUN Rscript /home/rstudio/install_packages.R:
3.752 Error in loadNamespace(x) : there is no package called ‘remotes’
3.752 Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
3.754 Execution halted
------
Dockerfile:36
--------------------
  34 |
  35 |     COPY --chown=rstudio:rstudio ./install_packages.R /home/rstudio/
  36 | >>> RUN Rscript /home/rstudio/install_packages.R
  37 |     # RUN R -e 'remotes::install_version("data.table", version = "1.15.2", dependencies=TRUE, Ncpus = 2, upgrade="never")'
  38 |     #
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c Rscript /home/rstudio/install_packages.R" did not complete successfully: exit code: 1

The amd64 one is compiled and working properly.
the Dockerfile:

FROM docker.io/rocker/rstudio:4.3.2
ARG BIOCvrs=3.18

RUN apt-get clean all && \
    apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y \
        cmake \ 
        gdal-bin \
        git-core \
        pkg-config \ 
        libfontconfig1-dev \
        libcurl4-openssl-dev \
        libgdal-dev \
        libicu-dev \
        libhdf5-dev \
        libssl-dev \
        libxml2-dev \
        libproj-dev \
        libpng-dev \
        libxt-dev \
        libbz2-dev \
        liblzma-dev \
        libglpk40 \
        libgit2-dev \
        zlib1g-dev && \
        mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc && \
        echo "options(repos = c(CRAN = 'https://cloud.r-project.org'), \
        download.file.method = 'libcurl', timeout=9999999, Ncpus = $(nproc))" | \
        tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site

RUN R -e 'install.packages("BiocManager", version = "${BIOCvrs}", lib="/usr/local/lib/R/library/"); \ 
    install.packages("remotes", version = "2.5.0", dependencies=TRUE, lib="/usr/local/lib/R/library/")'

COPY --chown=rstudio:rstudio ./install_packages.R /home/rstudio/
RUN Rscript /home/rstudio/install_packages.R
# RUN R -e 'remotes::install_version("data.table", version = "1.15.2", dependencies=TRUE, Ncpus = 2, upgrade="never")'
#
# RUN R -e 'Ncpus = "$(nproc)"; remotes::install_version("here", version = "1.0.1", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("dplyr", version = "1.1.4", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("tibble", version = "3.2.1", dependencies=TRUE, Ncpus = Ncpus, upgrade="never")'
#
# RUN R -e 'Ncpus = "$(nproc)"; remotes::install_version("stringr", version = "1.5.1", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("rlang", version = "1.1.3", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("forcats", version = "1.0.0", dependencies=TRUE, Ncpus = Ncpus, upgrade="never")'
#
# RUN R -e 'Ncpus = "$(nproc)"; remotes::install_version("tidyr", version = "1.3.1", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("readr", version = "2.1.5", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("vroom", version = "1.6.5", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("purrr", version = "1.0.2", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("openxlsx", version = "4.2.5.2", dependencies=TRUE, Ncpus = Ncpus, upgrade="never")' 
#
# RUN R -e 'Ncpus = "$(nproc)"; remotes::install_version("Seurat", version = "5.0.2", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("SeuratObject", version = "5.0.1", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("networkD3", version = "0.4", dependencies=TRUE, Ncpus = Ncpus, upgrade="never")'
#
# RUN R -e 'Ncpus = "$(nproc)"; remotes::install_version("ggplot2", version = "3.5.0", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("survminer", version = "0.4.9", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("survival", version = "3.5-8", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("e1071", version = "1.7-14", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("ggrepel", version = "0.9.5", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_version("rstatix", version = "0.7.2", dependencies=TRUE, Ncpus = Ncpus, upgrade="never"); \
#     remotes::install_github("omnideconv/immunedeconv", ref = "2.1.3", build_opts = c("--no-resave-data", \
#                             "--no-manual", "--no-build-vignettes"), Ncpus = Ncpus, upgrade = "never")'
#
# RUN R -e 'Ncpus = "$(nproc)";BiocManager::install(c("cBioPortalData", "biomaRt", "limma", \
#                         "TCGAbiolinks", "msigdbr", "edgeR", "maftools", "clusterProfiler", \
#                         "ReactomePA", "depmap", "org.Hs.eg.db"), ask=F, Ncpus = Ncpus)'
#
# RUN apt-get clean all && \
#     apt-get purge && \
#     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --chown=rstudio:rstudio ./rstudio-prefs.json /home/rstudio/.config/rstudio

install_packages.R script

remotes::install_version("data.table", version = "1.15.2", dependencies=TRUE, Ncpus = 2, upgrade="never")

I have tried many variations with R -e ' remotes::install_version.... or with a script, changing position regarding where the library is installed etc but always the same issue.
Do you experience this issue?
Any information that could point me to find the actual issue would be helpful as currently I am stuck.

Thanks!

@gaborcsardi
Copy link
Member

This is not cross compiling. Anyway,

3.752 Error in loadNamespace(x) : there is no package called ‘remotes’

means that you don't even have the remotes package installed. Install it first.

@ConYel
Copy link
Author

ConYel commented Oct 21, 2024

Yeap thank you for the correction, emulation is what docker uses.

Here it says it is installing it

RUN R -e 'install.packages("BiocManager", version = "${BIOCvrs}", lib="/usr/local/lib/R/library/"); \ 
    install.packages("remotes", version = "2.5.0", dependencies=TRUE, lib="/usr/local/lib/R/library/")'

Error report above:

 => CACHED [3/6] RUN R -e 'install.packages("BiocManager", version = "${BIOCvrs}", lib=  0.0s
 => CACHED [4/6] COPY --chown=rstudio:rstudio ./install_packages.R /home/rstudio/        0.0s

@gaborcsardi
Copy link
Member

That does not mean anything, install.packages() does not fail if the installation fails. Also, make sure that you are actually using that library.

In any case, this is clearly not a problem with the remotes package, so I am going to close this issue.

@ConYel
Copy link
Author

ConYel commented Oct 21, 2024

Np, thank you for the fast response.

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

2 participants