tidyverse package does not install

Hi. I am installing R and RStudio on Ubuntu 22.04.2 LTS. I am not installing inside anaconda.
I am able to get through tutorials until I need to use tidyverse.

When I install the tidyverse package, I get a large number of errors.
Could there be problem with the Ubuntu version?
I have uninstalled and reinstalled. This changed nothing.

I also successfully installed the "lifecycle" package (as per the posting on 2023-01-21)

see below for the errors

install.packages("tidyverse")
Installing package into ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘gargle’, ‘curl’, ‘systemfonts’, ‘textshaping’, ‘googledrive’, ‘googlesheets4’, ‘httr’, ‘ragg’, ‘rvest’

trying URL 'https://cloud.r-project.org/src/contrib/gargle_1.3.0.tar.gz'
Content type 'application/x-gzip' length 345590 bytes (337 KB)

downloaded 337 KB

trying URL 'https://cloud.r-project.org/src/contrib/curl_5.0.0.tar.gz'
Content type 'application/x-gzip' length 682047 bytes (666 KB)

etc
etc

  • 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] --------------------------------
    Configuration failed because libcurl was not found. Try installing:
  • deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
  • rpm: libcurl-devel (Fedora, CentOS, RHEL)
    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 MESSAGE] ---------------------------
    :1:10: fatal error: curl/curl.h: No such file or directory
    compilation terminated.

ERROR: configuration failed for package ‘curl’

  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/curl’
  • 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/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/systemfonts’
    ERROR: dependency ‘systemfonts’ is not available for package ‘textshaping’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/textshaping’
    ERROR: dependency ‘curl’ is not available for package ‘httr’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/httr’
    ERROR: dependency ‘httr’ is not available for package ‘gargle’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/gargle’
    ERROR: dependencies ‘systemfonts’, ‘textshaping’ are not available for package ‘ragg’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/ragg’
    ERROR: dependency ‘httr’ is not available for package ‘rvest’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/rvest’
    ERROR: dependencies ‘gargle’, ‘httr’ are not available for package ‘googledrive’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/googledrive’
    ERROR: dependencies ‘curl’, ‘gargle’, ‘googledrive’, ‘httr’ are not available for package ‘googlesheets4’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/googlesheets4’
    ERROR: dependencies ‘googledrive’, ‘googlesheets4’, ‘httr’, ‘ragg’, ‘rvest’ are not available for package ‘tidyverse’
  • removing ‘/home/mycomputer/R/x86_64-pc-linux-gnu-library/4.2/tidyverse’

The downloaded source packages are in
‘/tmp/Rtmp6ZNhq9/downloaded_packages’
Warning messages:
1: In install.packages("tidyverse") :
installation of package ‘curl’ had non-zero exit status
2: In install.packages("tidyverse") :
installation of package ‘systemfonts’ had non-zero exit status
3: In install.packages("tidyverse") :
installation of package ‘textshaping’ had non-zero exit status
4: In install.packages("tidyverse") :
installation of package ‘httr’ had non-zero exit status
5: In install.packages("tidyverse") :
installation of package ‘gargle’ had non-zero exit status
6: In install.packages("tidyverse") :
installation of package ‘ragg’ had non-zero exit status
7: In install.packages("tidyverse") :
installation of package ‘rvest’ had non-zero exit status
8: In install.packages("tidyverse") :
installation of package ‘googledrive’ had non-zero exit status
9: In install.packages("tidyverse") :
installation of package ‘googlesheets4’ had non-zero exit status
10: In install.packages("tidyverse") :
installation of package ‘tidyverse’ had non-zero exit status

Hi and welcome!

If you check the messages from the errors usually there are some useful hints in there, though sometimes it is difficult to spot :slight_smile:

  • Configuration failed because libcurl was not found. Try installing:
  • deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
  • rpm: libcurl-devel (Fedora, CentOS, RHEL)
    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=...'

and

  • --------------------------- [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] ---------------------------

I have highlighted the relevant lines in your case as you mentioned you use ubuntu, basically you have to install those packages and try installing again (https://ubuntu.com/server/docs/package-management), hopefully that will solve your problem.

Best!

1 Like

Hi Osigmas. Thanks very much for your valuable input.

This seems to have worked. tidyverse has now installed on Ubuntu 22.04.2 LTS

As you said, checking the messages for the errors will usually provide some useful hints.

I ended up installing:
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libfontconfig1-dev
sudo apt-get install libharfbuzz-dev libfribidi-dev
sudo apt-get install libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev

I did these installations one at a time and then checked the "[ ANTICONF ]" section of the error messages.

With each installation (except the last), a new suggestion was generated.

When I load tidyverse I get

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
:heavy_check_mark: dplyr 1.1.0 :heavy_check_mark: readr 2.1.4
:heavy_check_mark: forcats 1.0.0 :heavy_check_mark: stringr 1.5.0
:heavy_check_mark: ggplot2 3.4.1 :heavy_check_mark: tibble 3.2.1
:heavy_check_mark: lubridate 1.9.2 :heavy_check_mark: tidyr 1.3.0
:heavy_check_mark: purrr 1.0.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
:heavy_multiplication_x: dplyr::filter() masks stats::filter()
:heavy_multiplication_x: dplyr::lag() masks stats::lag()
:information_source: Use the conflicted package to force all conflicts to become errors

I think this is OK.

Regards and thanks very much for you help.

2 Likes

CBarring
You are my new hero. I did what you did exactly and it solved the tidyverse problem.
Glenn

Hi Glenn
In my first installation attempt, I got a huge number of error messages.
The first action was to install libcurl4-openssl-dev ("sudo apt-get install libcurl4-openssl-dev"). This action was based on the first response from Osigmas, which is in tidyverse package does not install

That still did not work. However, based on the advice from Osigmas, I checked the "ANTICONF" section of the new error message. Below is the ANTICONF section of the next error message.

--------------------------- [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=...'

So... I installed "libfontconfig1-dev" (sudo apt-get install libfontconfig1-dev).

This still did not work, but I was getting less error messages!!! I was making progress. I started saving the error messages in a spreadsheet so that I could track the errors.
I checked the new ANTICONF section. It was different.
The new ANTICONF section recommended installing libharfbuzz-dev libfribidi-dev (sudo apt-get install libharfbuzz-dev libfribidi-dev)
This also failed, but generated less error messages and had a new recommendation in the ANTICONF.

I kept on doing this. I eventually ended up installing:
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libfontconfig1-dev
sudo apt-get install libharfbuzz-dev libfribidi-dev
sudo apt-get install libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev

In your case, you will probably not have the same error messages. The ANTICONF sections will probably not be the same as mine.

That's how I did it. I am no expert in Linux or R. The credit must go to Osigmas. I just followed his general instructions: "If you check the messages from the errors usually there are some useful hints in there, though sometimes it is difficult to spot"

Regards

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.