Ubuntu

要將 R 更新到 v4,我刪除了 v3 但現在無法安裝

  • June 10, 2021

我有 R 版本 3.. 並且需要先安裝 v4 才能做到這一點我嘗試更新 R 但沒有工作。正如這篇文章所暗示的,我刪除了 R 包。當我試圖刪除它的輸出文件夾時,R -e '.libPaths()它告訴我沒有這樣的文件夾。然後我嘗試像在R的官方網頁中那樣安裝R v4。

sudo apt update -qq
sudo apt install --no-install-recommends software-properties-common dirmngr
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt install --no-install-recommends r-base

它給了我下面的輸出。現在我不知道該怎麼辦,請您幫我解決這個問題。我正在使用 Ubuntu 16

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.0-1.2004.0) but it is not going to be installed
         Depends: r-recommended (= 4.1.0-1.2004.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

總結問題

  • 使用者認為作業系統版本是“Ubuntu 16”
  • lsb_release -cs返回bionic即 Ubuntu 18.04
  • 嘗試安裝r-base表明存在 Ubuntu 20.04 ( focal) 儲存庫

通過評論/聊天,我們發現根本問題是使用者來源中不同分佈的混合,包括以下 R 特定的分佈:

deb cloud.r-project.org/bin/linux/… focal-cran40/ 

deb [arch=i386,amd64] cran.rstudio.com/bin/linux/… xenial/ 

deb cloud.r-project.org/bin/linux/… bionic-cran40/

在註釋掉所有非仿生儲存庫並重新執行apt update後,使用者能夠完成安裝。

引用自:https://unix.stackexchange.com/questions/653450