当“r-base”没有安装候选项时如何在 Ubuntu 18.04 上安装 R 4.0

当“r-base”没有安装候选项时如何在 Ubuntu 18.04 上安装 R 4.0

我关注此指令在 Ubuntu 18.04 中安装 R 4.0

$ sudo apt remove r-base
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
$ sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
$ sudo apt update
$ sudo apt install r-base

但是我收到这个错误信息:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package r-base is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  r-base-core r-doc-info r-doc-html r-base-html r-base-core:i386

E: Package 'r-base' has no installation candidate

我正在使用这个版本的 Ubuntu:

$ uname -a
Linux ip-172-31-28-209 5.4.0-1059-aws #62~18.04.1-Ubuntu SMP Fri Oct 22 21:51:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -cs
bionic

我该如何解决这个问题?


更新

$ sudo apt-cache policy r-base
r-base:
  Installed: (none)
  Candidate: (none)
  Version table:
     4.1.2-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.1.1-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.1.0-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.5-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.4-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.3-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.2-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.1-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.0-1.1804.0 -1
         -1 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     3.4.4-1ubuntu1 -1
         -1 http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

更新 2

$ sudo apt install r-base=4.1.2-1.1804.0
Reading package lists... Done
Building dependency tree
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.1.2-1.1804.0) but it is not installable
          Depends: r-recommended (= 4.1.2-1.1804.0) but it is not installable
          Recommends: r-base-html but it is not installable
          Recommends: r-doc-html but it is not installable
E: Unable to correct problems, you have held broken packages.

答案1

根据@user.dz的建议,我最终手动编辑/etc/apt/preferences并替换了引脚优先级,从-1到500

Package: *
Pin: release a=bionic*
Pin-Priority: 500

答案2

问题是 :

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
  Executing: /tmp/apt-key-gpghome.D7jTjWc4gW/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
  gpg: key 51716619E084DAB9: "Michael Rutter <[email protected]>" 1 new signature
  gpg: Total number processed: 1
  gpg:         new signatures: 1     

当您运行密钥服务器时,就像我的情况一样apt-key,密钥服务器已弃用。CRAN 上的 Ubuntu 档案使用密钥 ID/tmp/的密钥签名。要使用一个命令将密钥添加到您的系统,请使用Michael Rutter [email protected]0x51716619e084dab9

推荐方法:

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

希望这可以帮助。

有关的

答案3

假设你收到消息:

However the following packages replace it:
  r-base-core r-doc-info r-doc-html r-base-html r-base-core:i386

我想说的是也许r-base-core

相关内容