在Debian上更新R-- /etc/apt/sources.list的正确格式

3
  • I am unable to install some of the r packages I need. Here is an error message:

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

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

  • I tried to update R per directions on cran for debian (I'm running Linux Mint 18.2 Sonya).

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

    with the error message

    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使用以下语句来说明他们的指令:
“通过在 /etc/apt/sources.list 中适当地添加条目...可以安装最新的R版本,包括推荐的软件包...”
在此之前,我尝试过一些其他的故障排除步骤(我认为是 this question),也涉及到编辑此内容...
  • I tried modifying /etc/apt/sources.list The file I have now looks like:

     #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
    
  • I am still unable to update I'll include the output of apt-get commands below, but it's verbose and I'm hoping no one will need to read through it.

  • What should /etc/apt/sources.list look like?

  • What else am I doing wrong?

    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回答中添加密钥的那一行可能也非常重要。)为了引证,在这里varun palekar的回答here让我意识到,如果我的源列表中有格式不正确的条目,甚至良好格式的条目也将无法正常工作。
2个回答

5

对于Debian stretch,以下方法适用:

编辑/etc/apt/sources.list文件,添加:

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

然后安装并添加密钥:
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/获取了这个信息。


0

看起来从Cran获取的fivethirtyeight似乎不支持R 3.2.3版本。

https://cran.r-project.org/web/packages/fivethirtyeight/index.html 版本:0.4.0 依赖项:R(≥3.2.4) 您能否从Cran下载更新版本的R?

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

错误消息太长了,无法作为注释。请查看编辑。 - kchalk

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接