Can't install tidyverse on Posit Workbench (Ubuntu)

Hi all

Recently we're having trouble installing tidyverse on Posit Workbench. It seems to be due to due to problems with the "textshaping" package and its dependencies fribidi and harfbuzz.

> install.packages("tidyverse")
Installing package into ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘textshaping’, ‘ragg’

trying URL 'https://cran.rstudio.com/src/contrib/textshaping_0.3.6.tar.gz'
Content type 'application/x-gzip' length 35722 bytes (34 KB)
==================================================
downloaded 34 KB

trying URL 'https://cran.rstudio.com/src/contrib/ragg_1.2.5.tar.gz'
Content type 'application/x-gzip' length 427859 bytes (417 KB)
==================================================
downloaded 417 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_2.0.0.tar.gz'
Content type 'application/x-gzip' length 704618 bytes (688 KB)
==================================================
downloaded 688 KB

* installing *source* package ‘textshaping’ ...
** package ‘textshaping’ successfully unpacked and MD5 sums checked
** using staged installation
Package fribidi was not found in the pkg-config search path.
Perhaps you should add the directory containing `fribidi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fribidi' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lfreetype -lharfbuzz -lfribidi -lpng
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the harfbuzz freetype2 fribidi library. Try installing:
 * deb: libharfbuzz-dev libfribidi-dev (Debian, Ubuntu, etc)
 * rpm: harfbuzz-devel fribidi-devel (Fedora, EPEL)
 * csw: libharfbuzz_dev libfribidi_dev (Solaris)
 * brew: harfbuzz fribidi (OSX)
If harfbuzz freetype2 fribidi is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a harfbuzz freetype2 fribidi.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] ---------------------------
<stdin>:1:10: fatal error: hb-ft.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘textshaping’
* removing ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1/textshaping’
Warning in install.packages :
  installation of package ‘textshaping’ had non-zero exit status
ERROR: dependency ‘textshaping’ is not available for package ‘ragg’
* removing ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1/ragg’
Warning in install.packages :
  installation of package ‘ragg’ had non-zero exit status
ERROR: dependency ‘ragg’ is not available for package ‘tidyverse’
* removing ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

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

> install.packages("textshaping")
Installing package into ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/textshaping_0.3.6.tar.gz'
Content type 'application/x-gzip' length 35722 bytes (34 KB)
==================================================
downloaded 34 KB
 
* installing *source* package ‘textshaping’ ...
** package ‘textshaping’ successfully unpacked and MD5 sums checked
** using staged installation
Package fribidi was not found in the pkg-config search path.
Perhaps you should add the directory containing `fribidi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fribidi' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lfreetype -lharfbuzz -lfribidi -lpng
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the harfbuzz freetype2 fribidi library. Try installing:
 * deb: libharfbuzz-dev libfribidi-dev (Debian, Ubuntu, etc)
 * rpm: harfbuzz-devel fribidi-devel (Fedora, EPEL)
 * csw: libharfbuzz_dev libfribidi_dev (Solaris)
 * brew: harfbuzz fribidi (OSX)
If harfbuzz freetype2 fribidi is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a harfbuzz freetype2 fribidi.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] ---------------------------
<stdin>:1:10: fatal error: hb-ft.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘textshaping’
* removing ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1/textshaping’
Warning in install.packages :
  installation of package ‘textshaping’ had non-zero exit status
 
The downloaded source packages are in
 ‘/tmp/RtmprpdF26/downloaded_packages’
 
install.packages("fribidi")
Installing package into ‘/home/woodwards@dexcel.co.nz/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘fribidi’ is not available for this version of R
 
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

Our version of R is 2023.03.1 and we run it an Ubuntu box, more details below.


NAME="Ubuntu"

VERSION="18.04.5 LTS (Bionic Beaver)"

ID=ubuntu

ID_LIKE=debian

PRETTY_NAME="Ubuntu 18.04.5 LTS"

VERSION_ID="18.04
1 Like

You will need to install some operating system dependencies to make tidyverse work. One of the more easy ways to figure those dependencies is via public package manager https://packagemanager.posit.co/. If you browse there, select your Distribution on the top right corner of the page (Ubuntu 18.04 Bionic in your case) and then search for the R package (e.g. textshaping in your case which will lead you to Posit Package Manager), you will find the needed steps to install the system dependencies on that page under the section INSTALL SYSTEM PREREQUSITES.

Unfortunately you will need someone with admin privileges to run this commands.

See below a sample screen with the important bits surrounded by red boxes.

There is also a couple of additional possibilities how you can figure out system dependencies more programmatically via CLI only (e.g. GitHub - r-lib/pak: A fresh approach to package installation) but those CLI tools come with their own set of complexities (see an example on how pak could be used in install arrow from posit package manager binary in Ubuntu - #3 by Gabor)

In theory you even could use the information shared in Posit Package Manager under Install System Prerequisites as well to satisfy ALL system dependencies for R packages in the CRAN repo. I would however advise not to blindly install every system dependency since this could bloat your operating system installation for no reason. The information shared at the mentioned link contains comments and lists the dependencies for each R package separately so you could only selectively install dependencies for packages you know you will need.

My recommendation still would be to figure out package system dependencies step-by-step. If users start to use Workbench, it typically takes a few iterations to get system dependencies installed so that all needed packages can be installed. Over time the need for additional system dependencies becomes very low if not zero and the system enters more steady state.

2 Likes

Thank you that's awesome. Very helpful. I'll pass it on to our admins.

[Update]
Sorry issue resolved!
Turns out I just need to run sudo apt-get update
before installing system dependencies libharfbuzz-dev with sudo apt-get install libharfbuzz-dev
After successfully installing libharfbuzz-dev I can install tidyverse!

=======================================================================
[Original message]

Hi! Did you manage to get the issue resolved?

I am getting the same error. I tried to install the system dependencies libharfbuzz-dev libfribidi-dev like suggested in the error message. However I can't get libharfbuzz-dev to install.

root@posit-server-pro-standard-for-gcp-vm:/home/huiyan# apt-get install -y libharfbuzz-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libharfbuzz-dev : Depends: libgraphite2-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

I wonder if this is something your admin also encountered?

My environment (it's running with a GCP compute engine, deployed with RStudio Workbench Standard on GCP marketplace):

> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
1 Like

The good old apt-get update trap hit home again :slightly_smiling_face:. I am still not used to the same since I am so used to simply run yum install or dnf install on Redhat based systems.

Nevertheless glad you figured out this problem.

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.