Error when installing devtool in RStudio 2022.02.0 (Ubuntu 20.04)

Hi,

I got this error when tried to install devtool:
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status

For sure, the same error was repeated for dependencies.
My Rstudio version is 2022.02.0 installed in Ubuntu 20.04

Your help is much appreciated!
Eman

This excerpt from the console output only means that the process has been unsuccessful but it doesn't tell us what the cause might be, please post the complete console output you get so we can take a look at this.

So sorry. Here you are:

Installing package into ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependencies ‘credentials’, ‘curl’, ‘gert’, ‘gh’, ‘openssl’, ‘xml2’, ‘usethis’, ‘httr’, ‘rcmdcheck’, ‘roxygen2’, ‘rversions’

trying URL 'https://cloud.r-project.org/src/contrib/credentials_1.3.2.tar.gz'
Content type 'application/x-gzip' length 230070 bytes (224 KB)
==================================================
downloaded 224 KB

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

trying URL 'https://cloud.r-project.org/src/contrib/gert_1.5.0.tar.gz'
Content type 'application/x-gzip' length 66958 bytes (65 KB)
==================================================
downloaded 65 KB

trying URL 'https://cloud.r-project.org/src/contrib/gh_1.3.0.tar.gz'
Content type 'application/x-gzip' length 45619 bytes (44 KB)
==================================================
downloaded 44 KB

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

trying URL 'https://cloud.r-project.org/src/contrib/xml2_1.3.3.tar.gz'
Content type 'application/x-gzip' length 283965 bytes (277 KB)
==================================================
downloaded 277 KB

trying URL 'https://cloud.r-project.org/src/contrib/usethis_2.1.5.tar.gz'
Content type 'application/x-gzip' length 334909 bytes (327 KB)
==================================================
downloaded 327 KB

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/rcmdcheck_1.4.0.tar.gz'
Content type 'application/x-gzip' length 73522 bytes (71 KB)
==================================================
downloaded 71 KB

trying URL 'https://cloud.r-project.org/src/contrib/roxygen2_7.1.2.tar.gz'
Content type 'application/x-gzip' length 267337 bytes (261 KB)
==================================================
downloaded 261 KB

trying URL 'https://cloud.r-project.org/src/contrib/rversions_2.1.1.tar.gz'
Content type 'application/x-gzip' length 42064 bytes (41 KB)
==================================================
downloaded 41 KB

trying URL 'https://cloud.r-project.org/src/contrib/devtools_2.4.3.tar.gz'
Content type 'application/x-gzip' length 372413 bytes (363 KB)
==================================================
downloaded 363 KB

* 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/raizada/R/x86_64-pc-linux-gnu-library/3.6/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: openssl@1.1 (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/raizada/R/x86_64-pc-linux-gnu-library/3.6/openssl’
Warning in install.packages :
  installation of package ‘openssl’ had non-zero exit status
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
** using staged installation
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lxml2
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libxml-2.0 was not found. Try installing:
 * deb: libxml2-dev (Debian, Ubuntu, etc)
 * rpm: libxml2-devel (Fedora, CentOS, RHEL)
 * csw: libxml2_dev (Solaris)
If libxml-2.0 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libxml-2.0.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 ‘xml2’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status
ERROR: dependencies ‘openssl’, ‘curl’ are not available for package ‘credentials’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/credentials’
Warning in install.packages :
  installation of package ‘credentials’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/httr’
Warning in install.packages :
  installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘rcmdcheck’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/rcmdcheck’
Warning in install.packages :
  installation of package ‘rcmdcheck’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘roxygen2’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/roxygen2’
Warning in install.packages :
  installation of package ‘roxygen2’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘xml2’ are not available for package ‘rversions’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/rversions’
Warning in install.packages :
  installation of package ‘rversions’ had non-zero exit status
ERROR: dependencies ‘credentials’, ‘openssl’ are not available for package ‘gert’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/gert’
Warning in install.packages :
  installation of package ‘gert’ had non-zero exit status
ERROR: dependency ‘httr’ is not available for package ‘gh’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/gh’
Warning in install.packages :
  installation of package ‘gh’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘gert’, ‘gh’ are not available for package ‘usethis’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/usethis’
Warning in install.packages :
  installation of package ‘usethis’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘httr’, ‘rcmdcheck’, ‘roxygen2’, ‘rversions’ are not available for package ‘devtools’
* removing ‘/home/raizada/R/x86_64-pc-linux-gnu-library/3.6/devtools’
Warning in install.packages :
  installation of package ‘devtools’ had non-zero exit status

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

You are missing some system dependencies, you have to open a system terminal and install those.

sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev

Solved!
Much thanks!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.