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).
我注意到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让我意识到,如果我的源列表中有格式不正确的条目,甚至良好格式的条目也将无法正常工作。