skip to Main Content

Just tried to install the latest R on Docker with a vanilla Ubuntu 22.04 and I`m getting the following error at the apt install step:

$ apt-get install -y r-base
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 r-base : Depends: r-base-core (>= 4.3.3-1.2204.0) but it is not going to be installed
          Depends: r-recommended (= 4.3.3-1.2204.0) but it is not going to be installed
          Recommends: r-base-html but it is not going to be installed
          Recommends: r-doc-html but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I’ve installed the previous R version using the following Dockerfile with no problem in the past. Any clue what’s cooking with the latest R version? Here’s my Dockerile that I have been using for many years to start my R projects in Docker.

Dockerfile

FROM ubuntu:22.04

USER root

ENV DEBIAN_FRONTEND noninteractive

## INSTALL R
RUN apt update -y 
  && apt upgrade -y 
  && apt install -y 
  software-properties-common 
  dirmngr 
  gnupg2 
  wget

RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc 
  | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
  && add-apt-repository -y "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" 
  && apt-get update -y 
  && apt-get install -y r-base

EDITS AFTER INITAL POST

Ok… running the Dockerfile without the apt-get install -y r-base step allows me to look at the dependency tree of r-core within the docker container. For some reason, it seems that the latest r-core-base from the CRAN repo is not in the apt tree… Only the LTS version of the package is available, even though I get the CRAN when I look at the r-base policy…

r-base-core

$ apt policy r-base-core
r-base-core:
  Installed: (none)
  Candidate: 4.1.2-1ubuntu2
  Version table:
     4.1.2-1ubuntu2 500
        500 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages

r-base

$ apt policy r-base     
r-base:
  Installed: (none)
  Candidate: 4.3.3-1.2204.0
  Version table:
     4.3.3-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.3.2-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.3.1-4.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.3.1-3.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.3.1-2.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.3.1-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.3.0-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.3-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.2.20221110-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.2-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.1-3.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.1-2.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.1-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.2.0-1.2204.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ Packages
     4.1.2-1ubuntu2 500
        500 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages

Something is not right, right?

2

Answers


  1. Chosen as BEST ANSWER

    Ok, thanks to @ada-lovelace, looking at the Rocket Project, I found a solution. However, I'm not sure what is causing the issues at the base...

    Couple of clues:

    1. When I follow the CRAN steps in a Vanilla Ubuntu instance in us-west-1 everything is working

    2. Running the same steps in a 22.04 Docker image, it breaks at the install steps (Someone could confirm this, not sure how @ada-lovelace ran the steps exactly...)

    3. Looking at the Rocket Project they set their apt repo differently, they add ppa:marutter/rrutter4.0 instead of the CRAN deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/

    Here is a working version replacing the 'deb' entry from CRAN with a 'ppa:' entry from Rocket Project pointing to Michael Rutter repos. Something definetly change that I can't put my finger on as it use to work with the CRAN repos.

    Any suggestion what the issues are? Alternatively, CRAN could update/notify their users.

    Working DOCKERFILE

    FROM ubuntu:22.04
    
    USER root
    
    ENV DEBIAN_FRONTEND noninteractive
    
    ## INSTALL R
    RUN apt-get update 
      && apt-get install -y --no-install-recommends 
      software-properties-common 
      dirmngr 
      gnupg2 
      wget 
    
    
    RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc 
      | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
      && add-apt-repository -y "ppa:marutter/rrutter4.0" 
      && apt-get update -y 
      && apt-get install -y r-base
    

  2. Thanks to Michael Rutter, I tracked down the base of the issues. I am building the docker image on top of an ARM based M1 Mac platform and the CRAN repo only has AMD64 and i386 built packages (while Micheal PPA as AMD based packages as well). Specifying the correct architecture at the docker build time solves the problem.

    Good reminder that with Apple switches from Intel to M1, we need to start paying attention to hardware issues again!

    Basic Dockerfile

    FROM ubuntu:22.04
    
    USER root
    
    ENV DEBIAN_FRONTEND noninteractive
    
    ## INSTALL R
    RUN apt update -y 
      && apt upgrade -y 
      && apt install -y 
      software-properties-common 
      dirmngr 
      gnupg2 
      wget
    
    RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc 
      | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
      && add-apt-repository -y "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" 
      && apt-get update -y 
      && apt-get install -y r-base
    

    Docker Build Command

    docker build -t r-base --platform linux/amd64 . 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search