我的 Ubuntu 和 R 版本:
alvas@ubi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
alvas@ubi:~$ R
> version
_
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 2.2
year 2015
month 08
day 14
svn rev 69053
language R
version.string R version 3.2.2 (2015-08-14)
nickname Fire Safety
在 R 中,使用 Ubuntu,当我尝试安装时readr
:
> install.packages('readr')
Installing package into ‘/home/alvas/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency ‘curl’
trying URL 'https://mirrors.ebi.ac.uk/CRAN/src/contrib/curl_0.9.4.tar.gz'
Content type 'application/x-gzip' length 245598 bytes (239 KB)
==================================================
downloaded 239 KB
trying URL 'https://mirrors.ebi.ac.uk/CRAN/src/contrib/readr_0.2.2.tar.gz'
Content type 'application/x-gzip' length 146554 bytes (143 KB)
==================================================
downloaded 143 KB
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/alvas/R/x86_64-pc-linux-gnu-library/3.2/curl’
ERROR: dependency ‘curl’ is not available for package ‘readr’
* removing ‘/home/alvas/R/x86_64-pc-linux-gnu-library/3.2/readr’
The downloaded source packages are in
‘/tmp/Rtmp2Ke6na/downloaded_packages’
Warning messages:
1: In install.packages("readr") :
installation of package ‘curl’ had non-zero exit status
2: In install.packages("readr") :
installation of package ‘readr’ had non-zero exit status
> q()
因此,当我尝试安装时libcurl4
,我的依赖树不知何故搞砸了:
alvas@ubi:~$ sudo apt-get install libcurl4-openssl-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:
libcurl4-openssl-dev : Depends: libcurl3 (= 7.35.0-1ubuntu2) but 7.35.0-1ubuntu2.5 is to be installed
Depends: libkrb5-dev but it is not going to be installed
Depends: librtmp-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我试过了:
alvas@ubi:~$ sudo apt-get -y build-dep libcurl4-openssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'curl' as source package instead of 'libcurl4-openssl-dev'
E: Unable to find a source package for curl
它不起作用所以我清理了:
alvas@ubi:~$ sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
然后我这样做了:
alvas@ubi:~$ sudo apt-get install libcurl4-openssl-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:
libcurl4-openssl-dev : Depends: libcurl3 (= 7.35.0-1ubuntu2) but 7.35.0-1ubuntu2.5 is to be installed
Depends: libkrb5-dev but it is not going to be installed
Depends: librtmp-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages
因此我尝试安装依赖项:
alvas@ubi:~$ sudo apt-get install librtmp-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:
librtmp-dev : Depends: libgnutls-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我该如何解决脏依赖树以便readr
在 R 中成功安装?
答案1
每当您遇到依赖问题时,请运行:
sudo apt-get install -f
现在,要readr
在 R 中安装,对于 Ubuntu 16.04 和 R 版本 3.2.3(2015-12-10),我必须执行以下操作:
sudo apt-get install libcurl3
sudo apt-get install libcurl4-gnutls-dev
答案2
以下两个命令解决了我的问题
apt-get -y build-dep libcurl4-gnutls-dev apt-get -y install libcurl4-gnutls-dev