devtools in R studio

I have been struggling to download many packages as it reguires dev tool, However when i try installing devtools, i get this error

install.packages("devtools")
Installing package into ‘/home/temp/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
also installing the dependencies ‘systemfonts’, ‘textshaping’, ‘ragg’, ‘pkgdown’

trying URL 'https://cloud.r-project.org/src/contrib/systemfonts_1.0.5.tar.gz'
Content type 'application/x-gzip' length 80638 bytes (78 KB)

downloaded 78 KB

trying URL 'https://cloud.r-project.org/src/contrib/pkgdown_2.0.7.tar.gz'
Content type 'application/x-gzip' length 871465 bytes (851 KB)

downloaded 851 KB

  • installing source package ‘systemfonts’ ...
    ** package ‘systemfonts’ successfully unpacked and MD5 sums checked
    ** using staged installation
    Package fontconfig was not found in the pkg-config search path.
    Perhaps you should add the directory containing fontconfig.pc' to the PKG_CONFIG_PATH environment variable No package 'fontconfig' found Package freetype2 was not found in the pkg-config search path. Perhaps you should add the directory containing freetype2.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'freetype2' found
    Using PKG_CFLAGS=
    Using PKG_LIBS=-lfontconfig -lfreetype
    --------------------------- [ANTICONF] --------------------------------
    Configuration failed to find the fontconfig freetype2 library. Try installing:
  • deb: libfontconfig1-dev (Debian, Ubuntu, etc)
  • rpm: fontconfig-devel (Fedora, EPEL)
  • csw: fontconfig_dev (Solaris)
  • brew: freetype (OSX)
    If fontconfig freetype2 is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a fontconfig freetype2.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: fontconfig/fontconfig.h: No such file or directory
    compilation terminated.

ERROR: configuration failed for package ‘systemfonts’

  • removing ‘/home/temp/R/x86_64-pc-linux-gnu-library/4.3/systemfonts’
    Warning in install.packages :
    installation of package ‘systemfonts’ had non-zero exit status
    ERROR: dependency ‘systemfonts’ is not available for package ‘textshaping’
  • removing ‘/home/temp/R/x86_64-pc-linux-gnu-library/4.3/textshaping’
    Warning in install.packages :
    installation of package ‘textshaping’ had non-zero exit status
    ERROR: dependencies ‘systemfonts’, ‘textshaping’ are not available for package ‘ragg’
  • removing ‘/home/temp/R/x86_64-pc-linux-gnu-library/4.3/ragg’
    Warning in install.packages :
    installation of package ‘ragg’ had non-zero exit status
    ERROR: dependency ‘ragg’ is not available for package ‘pkgdown’
  • removing ‘/home/temp/R/x86_64-pc-linux-gnu-library/4.3/pkgdown’
    Warning in install.packages :
    installation of package ‘pkgdown’ had non-zero exit status
    ERROR: dependency ‘pkgdown’ is not available for package ‘devtools’
  • removing ‘/home/temp/R/x86_64-pc-linux-gnu-library/4.3/devtools’
    Warning in install.packages :
    installation of package ‘devtools’ had non-zero exit status

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

Can anyone help!!

Thank you

Hi @KKomal,

you are missing some system dependencies (for example: libfontconfig1-dev for ubuntu). So you will need to install them.

The Posit Public Package manager has a list of system requirements which are assumed to be installed on your system so that the package can be installed properly.

To find out what you need follow this steps:

  1. Go to https://packagemanager.posit.co/
  2. Click on setup and select the OS you have (ubuntu, fedora etc)
  3. Search for devtools
  4. Make sure to have all system dependencies listed under INSTALL SYSTEM PREREQUISITES FOR OS SYSTEM THAT YOU SELECTED IN STEP 2
  5. Install devtools again

Hope this helps.

1 Like

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