在 Ubuntu 22.04 上安装 R Docker 失败

问题描述 投票:0回答:1

刚刚尝试使用普通 Ubuntu 22.04 在 Docker 上安装最新的 R,我在 apt 安装步骤中收到以下错误:

$ 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.

我过去使用以下 Dockerfile 安装了以前的 R 版本,没有出现任何问题。知道最新的 R 版本有什么用处吗?这是我的 Dockerile,多年来我一直在使用它在 Docker 中启动我的 R 项目。

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

初始帖子后的编辑

好的...在没有

apt-get install -y r-base
步骤的情况下运行 Dockerfile 可以让我查看 docker 容器内
r-core
的依赖关系树。由于某种原因,CRAN 存储库中的最新
r-core-base
似乎不在 apt 树中...只有 LTS 版本的软件包可用,即使我在查看
r-base
政策时获得了 CRAN ...

r-基础核心

$ 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 基

$ 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

有什么不对劲,对吧?

r docker
1个回答
0
投票

好的,感谢@ada-lovelace,查看了Rocket Project,我找到了解决方案。但是,我不确定是什么导致了基地的问题......

一些线索:

  1. 当我在 us-west-1 的 Vanilla Ubuntu 实例中按照 CRAN 步骤操作时,一切正常

  2. 在 22.04 Docker 映像中运行相同的步骤,它会在安装步骤中中断(有人可以确认这一点,不确定 @ada-lovelace 是如何准确运行这些步骤的...)

  3. 查看 Rocket Project,他们以不同的方式设置 apt 存储库,他们添加

    ppa:marutter/rrutter4.0
    而不是 CRAN
    deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/

这是一个工作版本,将 CRAN 中的“deb”条目替换为 Rocket Project 中指向 Michael Rutter 存储库的“ppa:”条目。有些东西肯定会发生变化,但我无法指出,因为它用于与 CRAN 存储库一起工作。

有什么建议吗?或者,CRAN 可以更新/通知其用户。

工作 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
© www.soinside.com 2019 - 2024. All rights reserved.