2
votes

Recently, I started to learn R language by using Rstudio, but when I tied to install some packages i had some problems.

When I try to install the "rvest" package, it give the errors as following:

    > install.packages("rvest")Installing package into ‘/home/zm/R/x86_64-pc-linux-gnu-library/3.4’
    (as ‘lib’ is unspecified)also installing the dependencies ‘openssl’, ‘httr’
    ??URL’https://cran.rstudio.com/src/contrib/openssl_0.9.7.tar.gz'Content type 'application/x-gzip' length 1243577 bytes (1.2 MB)==================================================downloaded 1.2 MB
    ??URL’https://cran.rstudio.com/src/contrib/httr_1.3.1.tar.gz'Content type 'application/x-gzip' length 147593 bytes (144 KB)==================================================downloaded 144 KB
    ??URL’https://cran.rstudio.com/src/contrib/rvest_0.3.2.tar.gz'Content type 'application/x-gzip' length 1597137 bytes (1.5 MB)==================================================downloaded 1.5 MB
    * installing *source* package ‘openssl’ ...** ???‘openssl’??????MD5???Using PKG_CFLAGS=
    ------------------------- ANTICONF ERROR ---------------------------
    Configuration failed because openssl was not found. Try installing:
     * deb: libssl-dev (Debian, Ubuntu, etc)
     * rpm: openssl-devel (Fedora, CentOS, RHEL)
     * csw: libssl_dev (Solaris)
     * brew: [email protected] (Mac OSX)
    If openssl is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a openssl.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 ‘openssl’* removing ‘/home/zm/R/x86_64-pc-linux-gnu-library/3.4/openssl’Warning in install.packages :
      installation of package ‘openssl’ had non-zero exit statusERROR: dependency ‘openssl’ is not available for package ‘httr’* removing ‘/home/zm/R/x86_64-pc-linux-gnu-library/3.4/httr’Warning in install.packages :
      installation of package ‘httr’ had non-zero exit statusERROR: dependency ‘httr’ is not available for package ‘rvest’* removing ‘/home/zm/R/x86_64-pc-linux-gnu-library/3.4/rvest’Warning in install.packages :
      installation of package ‘rvest’ had non-zero exit status

The downloaded source packages are in ‘/tmp/RtmpuOfZU9/downloaded_packages’


I think the following is the key point of my problem:

The configuration failed because openssl wasn't found.

I tried to install:

  • deb: libssl-dev (Debian, Ubuntu, etc)
  • rpm: openssl-devel (Fedora, CentOS, RHEL)
  • csw: libssl_dev (Solaris)
  • brew: [email protected] (Mac OSX)

If openssl is already installed, check that 'pkg-config' is in your PATH and PKG_CONFIG_PATH contains a openssl.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=...'

I also started to install the packages in Ubuntu. However, I even didn't success to install them in Ubuntu.

And I also tried the following method: export PKG_CONFIG_PATH=/cv/lib:$PKG_CONFIG_PATH Without success..

Could somebody help me to figure out what happened, thank you very much!

2

2 Answers

2
votes

I have the same problem as You. You need to do a few thing (nuclear option but it should work):

sudo add-apt-repository 'deb 
https://mirrors.nic.cz/R/bin/linux/ubuntu trusty/'
sudo apt-get update
sudo apt-get install r-base-dev
sudo apt-get install libxml2-dev
sudo apt-get install libssl-dev
sudo -i R

or if You use rstudio:

sudo -i rstudio

and in R:

install.package('rvest')

I did all above and maybe

pkg-config rvest

in a console and it worked. R shoud show during package installation some messages titled as You can see "anticonf error" and there it should be written what else should You install. My list consisted those packages. I see that some time has passed since Your herby request, but it should be answered for the sake of next generations.

1
votes

Just install libssl-dev using aptitude or apt as stated in the error message you report.

I had the same problem of openssl not installing from rstudio on OSX when trying to install tidyverse package.

The solution for me was to try to install openssl from r prompt, I then received instruction from the shell under "-- ANTICONF ERROR --":

> install.packages("openssl")
trying URL 'https://cloud.r-project.org/src/contrib/openssl_1.3.tar.gz'
Content type 'application/x-gzip' length 1218896 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

During startup - Warning messages:
1: Setting LC_TIME failed, using "C" 
2: Setting LC_MESSAGES failed, using "C" 
3: Setting LC_MONETARY failed, using "C" 
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Homebrew 2.0.6
Homebrew/homebrew-core (git revision 6abd; last commit 2019-03-30)
Homebrew/homebrew-cask (git revision 51ddc; last commit 2019-03-30)
Using PKG_CFLAGS=-I/usr/local/opt/[email protected]/include -I/usr/local/opt/openssl/include
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: [email protected] (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.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 ‘openssl’
* removing ‘/usr/local/Cellar/r/3.5.3/lib/R/library/openssl’ 

For me under OSX, I just had to install [email protected] using the package manager

brew install [email protected]

I could then install tidiverse normally from R. then use it from rstudio.

I thus believe that you should be able to install rvest from Rstudio once you will have installed libssl-dev from the shell, using something like

aptitude install libssl-dev

or similar apt command