简体   繁体   English

R 和 libcurl4 在 Ubuntu 18.04 中几乎不能共存

[英]R and libcurl4 hardly coexist in Ubuntu 18.04

I have Ubuntu 18.04.我有 Ubuntu 18.04。 I recently upgraded my R version from 3.2.3 to 3.6.3 .我最近将我的 R 版本从3.2.3升级到3.6.3 Upon reinstallation of the packages that I need, I stumbled upon an issue generated by httr and curl .重新安装我需要的软件包后,我偶然发现了httrcurl生成的问题。 Other posts, especially this (but also this and this ) have been written about similar (if not almost identical issues) but following them led me nowhere and my issue is still there.其他帖子,尤其是this (还有thisthis )已经写过类似的(如果不是几乎相同的问题),但跟随它们让我无处可去,我的问题仍然存在。

I'm sorry in advance for the long post, but I think that other people will eventually stumble upon this issue so I want to be as complete as possible.对于这篇长篇文章,我很抱歉,但我认为其他人最终会偶然发现这个问题,所以我希望尽可能完整。 Here's what happens.这就是发生的事情。

I am trying to install a package that has httr among the dependencies.我正在尝试安装在依赖项中有httr的 package。 Since I need to reinstall it, I tried to do so from install.packages("httr") and from a local path (see example).由于我需要重新安装它,因此我尝试从install.packages("httr")和本地路径(参见示例)进行安装。

> install.packages("/home/schmat/Documents/Marti/packages/httr_1.4.1.tar.gz", repos = NULL, type="source")
Installing package into ‘/home/schmat/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
ERROR: dependency ‘curl’ is not available for package ‘httr’

This showed me that curl is not available, so I tried to install curl the same way.这告诉我curl不可用,所以我尝试以相同的方式安装curl Only to get this:只为了得到这个:

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=...'
--------------------------------------------------------------------

Since this showed that I needed to install libcurl4-openssl-dev , I tried to do it via apt install and I got:因为这表明我需要安装libcurl4-openssl-dev ,所以我尝试通过apt install来安装,我得到了:

The following packages have unmet dependencies:
 libcurl4-openssl-dev : Depends: libcurl4 (= 7.58.0-2ubuntu3.8) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

So I tried to add the libcurl.pc file that I have to $PKG_CONFIG_PATH :所以我尝试将我必须的libcurl.pc文件添加到$PKG_CONFIG_PATH

export PKG_CONFIG_PATH=/home/schmat/anaconda3/lib/pkgconfig/libcurl.pc

Without any result.没有任何结果。

I tried the git clone approach suggested in this thread , without any success.我尝试了此线程中建议的git clone方法,但没有成功。

At this point, I tried to install libcurl4 from apt install .此时,我尝试从apt install安装libcurl4 However, by doing so my R gets removed from the system.但是,通过这样做,我的 R 将从系统中删除 I reinstalled R (same version, 3.6.3) and this removes libcurl4 .我重新安装了 R (相同版本,3.6.3),这删除libcurl4

I am stuck in this loop where I can't get what I need because something else is missing, in a circle.我被困在这个循环中,我无法得到我需要的东西,因为在一个圆圈中缺少其他东西。 How is that possible?这怎么可能? How come, that an R package (latest version, March 26, 2020!) which ultimately needs some curl function cannot be installed, because curl cannot coexist with R/3.6.3 ? How come, that an R package (latest version, March 26, 2020!) which ultimately needs some curl function cannot be installed, because curl cannot coexist with R/3.6.3 ?

It's incredible how, after days of trial and error, the very moment I decided to write a question here I also found the answer minutes later.令人难以置信的是,经过几天的反复试验,当我决定在这里写一个问题的那一刻,我也在几分钟后找到了答案。

In one of the links I provided ( this ), OP mentions that he/she cleaned the /etc/apt/sources.list from "rubbish".在我提供的链接之一( this )中,OP 提到他/她从“垃圾”中清除了/etc/apt/sources.list It is not, however, declared which rubbish or how the file was edited.但是,没有声明是哪个垃圾或文件是如何编辑的。

what I did (and worked) for me was the following.我为我所做的(和工作的)如下。

  1. I edited the file (with sudo rights) changing the last two lines from:我编辑了文件(具有 sudo 权限),将最后两行更改为:
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/
# deb-src https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/

To:至:

deb https://cloud.r-project.org/bin/linux/ubuntu/ bionic-cran35/
deb-src https://cloud.r-project.org/bin/linux/ubuntu/ bionic-cran35/

Note that I changed "xenial" to "bionic", and I uncommented the last line.请注意,我将“xenial”更改为“bionic”,并取消了最后一行的注释。

  1. Closed and re-opened the terminal.关闭并重新打开终端。

  2. Ran sudo apt update and sudo apt upgrade .sudo apt updatesudo apt upgrade

  3. Installed libcurl4 via sudo apt install -y libcurl4 .通过sudo apt install -y libcurl4 This still uninstalls R and its components.这仍然会卸载R及其组件。

  4. Installed libcurl4-openssl-dev via sudo apt install -y libcurl4-openssl-dev .通过sudo apt install -y libcurl4-openssl-dev

  5. Ran sudo apt update and sudo apt upgrade .sudo apt updatesudo apt upgrade

  6. Installed r-base via sudo apt install -y r-base .通过sudo apt install -y r-base This time, libcurl4 is not uninstalled.这次没有卸载libcurl4

  7. Run R , and install the package that I needed.运行R ,并安装我需要的 package。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM