r - 在 debian 上更新 R——/etc/apt/sources.list 的正确形式

标签 r linux

  • 我无法安装一些我需要的 r 包。这是一条错误消息:

    Warning in install.packages : package 'fivethirtyeight' is not available (for R version 3.2.3)
    

我的 R 版本与我最近安装的操作系统相同。

  • 我尝试按照指示更新 R on cran对于 debian(我正在运行 Linux Mint 18.2 Sonya)。

     apt-get update
     apt-get install r-base r-base-dev
    

    错误信息

    r-base is already the newest version (3.2.3-4). 
    r-base-dev is already the newest version (3.2.3-4).
    

这不应该是真的——我相当确定最新版本是 3.5。大约在这个时候,Rstudio 停止打开,我无法测试包安装,我预计在我有一个好的 R 版本后需要重新安装 Rstudio。

我注意到 cran 用

断言他们的指令

With an appropriate entry in /etc/apt/sources.list ... the newest R release including recommended packages can be installed ...

我之前尝试过的其他一些故障排除步骤(我认为是 this question )也涉及到编辑这个,所以......

  • 我尝试修改/etc/apt/sources.list 我现在拥有的文件如下所示:

     #deb cdrom:[Linux Mint 18.2 _Sonya_ - Release amd64 20170628]/ xenial contrib m$
     deb http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/
     deb http://us.archive.ubuntu.com/ubuntu/ sonya main restricted
    
  • 我仍然无法更新 我将在下面包含 apt-get 命令的输出,但它很冗长,我希望没有人需要阅读它。

  • /etc/apt/sources.list 应该是什么样的?

  • 我还做错了什么?

    sudo apt-get update
    
    Ign:1 http://packages.linuxmint.com sonya InRelease
    Get:2 http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ 
    [ommited for lack of reputation to post links]...
    Ign:22 http://us.archive.ubuntu.com/ubuntu sonya/restricted Translation-en_US
    Ign:23 http://us.archive.ubuntu.com/ubuntu sonya/restricted Translation-en
    Fetched 4,371 B in 6s (710 B/s)
    Reading package lists... Done
    W: GPG error: http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCAE2A0E115C3D8A
    W: The repository 'http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease' is not signed.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: The repository 'http://us.archive.ubuntu.com/ubuntu sonya Release' does not have a Release file.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/sonya/main/binary-amd64/Packages  404  Not Found [IP: 91.189.91.26 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    
    
    sudo apt-get install r-base r-base-dev
    
    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 (>= 3.5.0-1~stretchcran.0) but it is not going to be installed
          Depends: r-recommended (= 3.5.0-1~stretchcran.0) but it is not going to be installed
     r-base-dev : Depends: r-base-core (>= 3.5.0-1~stretchcran.0) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

附言这是我的第一个 stackoverflow 帖子。欢迎就我如何改进这篇文章提出建议。

太平洋时间 1:05 编辑: 前两个评论中的任何一个键都不起作用。下面是新的错误消息:

kchalk@kchalk-Cin ~ $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Executing: /tmp/tmp.n3xDeOodv5/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: "Michael Rutter <marutter@gmail.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
kchalk@kchalk-Cin ~ $ sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
kchalk@kchalk-Cin ~ $ sudo apt-get update
...Ign:25 http://us.archive.ubuntu.com/ubuntu sonya/restricted Translation-en     
Fetched 190 kB in 6s (30.1 kB/s)                                               
Reading package lists... Done
W: GPG error: http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCAE2A0E115C3D8A
W: The repository 'http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://us.archive.ubuntu.com/ubuntu sonya Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/sonya/main/binary-amd64/Packages  404  Not Found [IP: 91.189.91.26 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
kchalk@kchalk-Cin ~ $ sudo apt-get install r-base
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 (>= 3.5.0-1~stretchcran.0) but it is not going to be installed
          Depends: r-recommended (= 3.5.0-1~stretchcran.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

解决方案!

我将标记为正确的答案(由 Carlos Santillan 撰写)说要运行:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base

这并没有完全解决我的问题——我将保留上面给我的错误进行编辑,以防其他人遇到这种情况。起作用的是注释掉/etc/apt/sources.list 中的所有内容并包括以下

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

然后我可以运行 apt-get update 和 apt-get install,最后得到一个足够新的 R 版本。(Carlos Santillan 的答案中添加 key 的那一行在这里可能也很重要。)本着引用的精神, varun palekar 的回答 here是什么最终让我意识到,在我的源列表中有一个格式错误的条目会阻止甚至格式正确的条目运行。

最佳答案

对于 Debian stretch,以下过程对我有用:

编辑 /etc/apt/sources.list 添加

deb http://cran.rstudio.com/bin/linux/debian stretch-cran35/

然后安装并添加 key :

sudo apt install dirmngr
sudo apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF'

因此更新并安装 R:

sudo apt update
sudo apt install r-base

我从 https://www.linode.com/docs/development/r/how-to-install-r-on-ubuntu-and-debian/ 得到的

关于r - 在 debian 上更新 R——/etc/apt/sources.list 的正确形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50357464/

相关文章:

Rstudio 不启动 "Unable to determine real path of R script"由于 R 编译期间的先前错误

r - write.csv 用于大型 data.table

linux - 我可以使用 Kprobe 阻止新进程执行吗?

linux - 如何从文件[shell]中某些特定行的末尾删除\n?

linux - 海湾合作委员会错误 : 'for' loop initial declaration used outside C99 mode

r - 如何进行宽度取决于总和本身的滚动总和?

r - 在 R 中将字符向量列表转换为数字的最快方法

r - 从 URL 提取 CSV 的基本功能

python - Paramiko,sftp 无法从 linux 服务器下载到 windows

javascript - Upstart 说我的脚本正在运行,但 API 在我重新启动进程之前不会返回数据