6
install.packages('plotly')

I try to install the plotly package by running the code above in RStudio. However, it fails and returns the below. I'm a newbie and I can't read this properly. What should I do to fix this?

I also try to install curl, openssl, and httr manually first, but it makes no difference. Also, I'm using Ubuntu 20.04 LTS if relevant.

Installing package into ‘/home/ariel/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘openssl’, ‘httr’

trying URL 'https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz'
Content type 'application/x-gzip' length 673779 bytes (657 KB)
==================================================
downloaded 657 KB

trying URL 'https://cloud.r-project.org/src/contrib/openssl_1.4.3.tar.gz'
Content type 'application/x-gzip' length 1207708 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'https://cloud.r-project.org/src/contrib/httr_1.4.2.tar.gz'
Content type 'application/x-gzip' length 159950 bytes (156 KB)
==================================================
downloaded 156 KB

trying URL 'https://cloud.r-project.org/src/contrib/plotly_4.9.2.1.tar.gz'
Content type 'application/x-gzip' length 3709741 bytes (3.5 MB)
==================================================
downloaded 3.5 MB

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
** using staged installation
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/ariel/R/x86_64-pc-linux-gnu-library/4.0/curl’
Warning in install.packages :
  installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
--------------------------- [ANTICONF] --------------------------------
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 MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: No such file or directory
    1 | #include <openssl/opensslv.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/ariel/R/x86_64-pc-linux-gnu-library/4.0/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/ariel/R/x86_64-pc-linux-gnu-library/4.0/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘plotly’
* removing ‘/home/ariel/R/x86_64-pc-linux-gnu-library/4.0/plotly’
Warning in install.packages :
  installation of package ‘plotly’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpJQIJ6f/downloaded_packages’
3
  • 9
    Maybe installing libcurl4-openssl-dev is solves your problem (such as sudo apt install libcurl4-openssl-dev). Commented Dec 4, 2020 at 4:11
  • 5
    The error message tells you what system dependencies you need to install. These dependencies are not R specific so you need to install them outside of R. Look for the text that says "Try installing" and install however is appropriate for your OS. Commented Dec 4, 2020 at 6:05
  • 3
    @MrFlick Thanks for clarifying this! Everything went back normal after sudo apt install libcurl4-openssl-dev and sudo apt install libssl-dev. And I know a little bit more about reading the error messages. You can make the comment an answer if you want. Give you some points after I accept it. Thanks again! Commented Dec 4, 2020 at 15:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.