non-zero exit status while installing devtools in WSL ubuntu 22.04

Hello everyone, I got bunch of errors while installing devtools in WSL ubuntu, I appreciate your help in advance
I tried all the solutions such as updating openssl, installing libxml2,libcurl4,libssl , using dependencies=TRUE , ...
but it did not work, because of limitation in using url I just write some errors occured
install.packages("devtools")
Installing package into ‘/home/masoud2204/R/x86_64-pc-linux-gnu-library/4.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘systemfonts’, ‘textshaping’, ‘gert’, ‘ragg’, ‘usethis’, ‘pkgdown’
URL 'https://cloud.r-project.org/src/contrib/systemfonts_1.1.0.tar.gz': status was 'SSL connect error'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cloud.r-project.org/src/contrib/systemfonts_1.1.0.tar.gz'
....
installation of package ‘pkgdown’ had non-zero exit status

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

1 Like

You didn't show the actual error messages about why those packages failed to install. It is probably because their required system packages are missing. You can look them up like this:

❯ pak::pkg_sysreqs("devtools")
── Install scripts ────────────────────────────────────────────── Ubuntu 2204 ──
apt-get -y update
apt-get -y install libx11-dev git libcurl4-openssl-dev libssl-dev make \
  zlib1g-dev pandoc libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev \
  libicu-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libxml2-dev

── Packages and their system dependencies ──────────────────────────────────────
clipr       – libx11-dev
credentials – git
curl        – libcurl4-openssl-dev, libssl-dev
fs          – make
gitcreds    – git
httpuv      – make, zlib1g-dev
knitr       – pandoc
openssl     – libssl-dev
pkgdown     – pandoc
ragg        – libfreetype6-dev, libjpeg-dev, libpng-dev, libtiff-dev
remotes     – git
rmarkdown   – pandoc
sass        – make
stringi     – libicu-dev
systemfonts – libfontconfig1-dev, libfreetype6-dev
textshaping – libfreetype6-dev, libfribidi-dev, libharfbuzz-dev
xml2        – libxml2-dev

If you have password-less sudo configured, then pak will also install them automatically for you if you run:

pak::pkg_install("devtools")

You can install pak like this if you go that way:

install.packages("pak", repos = sprintf(
  "https://r-lib.github.io/p/pak/stable/%s/%s/%s",
  .Platform$pkgType,
  R.Version()$os,
  R.Version()$arch
))

Cf. All about installing pak. — Installing pak • pak

1 Like

Thanks for quick response, I got this bunch of errors as below:
Warning in install.packages :
URL 'https://cloud.r-project.org/src/contrib/devtools_2.4.5.tar.gz': status was 'SSL connect error'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cloud.r-project.org/src/contrib/devtools_2.4.5.tar.gz'
Warning in install.packages :
download of package ‘devtools’ failed

  • installing source package ‘ragg’ ...
    ** package ‘ragg’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Package libtiff-4 was not found in the pkg-config search path.
    Perhaps you should add the directory containing libtiff-4.pc' to the PKG_CONFIG_PATH environment variable Package 'libtiff-4', required by 'virtual:world', not found Package 'libjpeg', required by 'virtual:world', not found Package libtiff-4 was not found in the pkg-config search path. Perhaps you should add the directory containing libtiff-4.pc'
    to the PKG_CONFIG_PATH environment variable
    Package 'libtiff-4', required by 'virtual:world', not found
    Package 'libjpeg', required by 'virtual:world', not found
    Using PKG_CFLAGS=
    Using PKG_LIBS=-lfreetype -lpng16 -ltiff -lz -ljpeg -lbz2
    -----------------------------[ ANTICONF ]-------------------------------
    Configuration failed to find one of freetype2 libpng libtiff-4 libjpeg. Try installing:
  • deb: libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev (Debian, Ubuntu, etc)
  • rpm: freetype-devel libpng-devel libtiff-devel libjpeg-devel (Fedora, CentOS, RHEL)
  • csw: libfreetype_dev libpng16_dev libtiff_dev libjpeg_dev (Solaris)
    If freetype2 libpng libtiff-4 libjpeg is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a freetype2 libpng libtiff-4 libjpeg.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] ---------------------------
    :1:10: fatal error: ft2build.h: No such file or directory
    compilation terminated.

ERROR: configuration failed for package ‘ragg’

  • removing ‘/home/masoud2204/R/x86_64-pc-linux-gnu-library/4.4/ragg’
    Warning in install.packages :
    installation of package ‘ragg’ had non-zero exit status
  • installing source package ‘usethis’ ...
    ** package ‘usethis’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
  • DONE (usethis)
    ERROR: dependency ‘ragg’ is not available for package ‘pkgdown’
  • removing ‘/home/masoud2204/R/x86_64-pc-linux-gnu-library/4.4/pkgdown’
    Warning in install.packages :
    installation of package ‘pkgdown’ had non-zero exit status

and another problem that I noticed is that when I want to run <apt-get -y update>, I get these messages
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

You need to run apt-get from an admin shell, e.g.

sudo apt-get ....
1 Like

This topic was automatically closed 7 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.