I am unable to install the "clusterProfiler" package on my Ubuntu 22.04.4 LTS system. Can you suggest a solution?

> BiocManager::install("clusterProfiler")
'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories", package = "BiocManager")'
for details.
Replacement repositories:
    CRAN: https://cloud.r-project.org
Bioconductor version 3.14 (BiocManager 1.30.23), R 4.1.2 (2021-11-01)
Installing package(s) 'clusterProfiler'
also installing the dependencies ‘ggtree’, ‘enrichplot’

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/ggtree_3.2.1.tar.gz'
Content type 'application/octet-stream' length 344549 bytes (336 KB)
==================================================
downloaded 336 KB

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/enrichplot_1.14.2.tar.gz'
Content type 'application/octet-stream' length 88711 bytes (86 KB)
==================================================
downloaded 86 KB

trying URL 'https://bioconductor.org/packages/3.14/bioc/src/contrib/clusterProfiler_4.2.2.tar.gz'
Content type 'application/octet-stream' length 2659285 bytes (2.5 MB)
==================================================
downloaded 2.5 MB

* installing *source* package ‘ggtree’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in get(x, envir = ns, inherits = FALSE) : 
  object 'warning_wrap' not found
Error: unable to load R code in package ‘ggtree’
Execution halted
ERROR: lazy loading failed for package ‘ggtree’
* removing ‘/home/rifat/R/x86_64-pc-linux-gnu-library/4.1/ggtree’
ERROR: dependency ‘ggtree’ is not available for package ‘enrichplot’
* removing ‘/home/rifat/R/x86_64-pc-linux-gnu-library/4.1/enrichplot’
ERROR: dependency ‘enrichplot’ is not available for package ‘clusterProfiler’
* removing ‘/home/rifat/R/x86_64-pc-linux-gnu-library/4.1/clusterProfiler’

The downloaded source packages are in
	‘/tmp/Rtmpx6wWMx/downloaded_packages’
Installation paths not writeable, unable to update packages
  path: /usr/lib/R/library
  packages:
    boot, class, cluster, codetools, foreign, KernSmooth, lattice, mgcv, nlme, nnet, rpart, spatial, survival
Warning messages:
1: In install.packages(...) :
  installation of package ‘ggtree’ had non-zero exit status
2: In install.packages(...) :
  installation of package ‘enrichplot’ had non-zero exit status
3: In install.packages(...) :
  installation of package ‘clusterProfiler’ had non-zero exit status

This is a bug that has been reported, try the solutions suggested in this post.

The easiest if possible is simply to update R.

In general I suggest you use PPPM (Posit Package Manager) for package binaries so you don't need to compile them yourself,, and pak (All about installing pak. — Installing pak • pak) for automatic system requirements installation:

options(repos = c(
  PPM = "https://packagemanager.posit.co/cran/__linux__/jammy/latest", 
  CRAN = "https://cloud.r-project.org"
))
pak::pkg_install("clusterProfiler")

Unfortunately in this case they don't help, it seems like ggtree simply does not work on this R version, and you'll need a newer R version unless ggtree gets fixed.

Thanks, for your solution. It worked.

1 Like