0

I am working on a RNAseq analzsis in R. I have installed R in my conda environment. R is fictional and the version is: 4.3.1 In a jupyter notebook I am not being able to download some packages. some of these packages are 'curl', 'systemfonts' which are dependencies for the package 'devtools'. any suggestions.

this is what I am getting:

install.packages('devtools')

also installing the dependencies ‘credentials’, ‘httr2’, ‘systemfonts’, ‘textshaping’, ‘curl’, ‘gert’, ‘gh’, ‘httr’, ‘ragg’, ‘usethis’, ‘pkgdown’, ‘rcmdcheck’, ‘rversions’, ‘urlchecker’


Warning message in install.packages("devtools"):
“installation of package ‘systemfonts’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘curl’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘credentials’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘httr2’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘textshaping’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘httr’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘rcmdcheck’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘rversions’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘urlchecker’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘gert’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘gh’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘ragg’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘usethis’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘pkgdown’ had non-zero exit status”
Warning message in install.packages("devtools"):
“installation of package ‘devtools’ had non-zero exit status”
Updating HTML index of packages in '.Library'

Making 'packages.html' ...
 done

this is the complete error:

* 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
** libs
using C++ compiler: ‘x86_64-conda-linux-gnu-c++ (conda-forge gcc 13.1.0-0) 13.1.0’
using C++11
rm -f systemfonts.so caches.o cpp11.o dev_metrics.o font_matching.o font_registry.o ft_cache.o string_shape.o font_metrics.o font_fallback.o string_metrics.o emoji.o cache_store.o init.o unix/FontManagerLinux.o
x86_64-conda-linux-gnu-c++ -std=gnu++11 -I"/home/stud9/miniconda3/envs/gxp/lib/R/include" -DNDEBUG  -I'/home/stud9/miniconda3/envs/gxp/lib/R/library/cpp11/include' -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/stud9/miniconda3/envs/gxp/include -I/home/stud9/miniconda3/envs/gxp/include -Wl,-rpath-link,/home/stud9/miniconda3/envs/gxp/lib    -fpic  -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/stud9/miniconda3/envs/gxp/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base-split_1689933267587/work=/usr/local/src/conda/r-base-4.3.1 -fdebug-prefix-map=/home/stud9/miniconda3/envs/gxp=/usr/local/src/conda-prefix  -c caches.cpp -o caches.o
In file included from caches.h:7,
                 from caches.cpp:1:
ft_cache.h:9:10: fatal error: ft2build.h: No such file or directory
    9 | #include <ft2build.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make: *** [/home/stud9/miniconda3/envs/gxp/lib/R/etc/Makeconf:200: caches.o] Error 1
ERROR: compilation failed for package ‘systemfonts’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/systemfonts’
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/x86_64-linux-gnu
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] ---------------------------
In file included from /home/stud9/miniconda3/envs/gxp/x86_64-conda-linux-gnu/sysroot/usr/include/features.h:361,
                 from /usr/include/x86_64-linux-gnu/sys/types.h:25,
                 from /usr/include/x86_64-linux-gnu/curl/system.h:430,
                 from /usr/include/x86_64-linux-gnu/curl/curl.h:38,
                 from <stdin>:1:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:492:49: error: missing binary operator before token "("
  492 | #if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
      |                                                 ^
In file included from /home/stud9/miniconda3/envs/gxp/x86_64-conda-linux-gnu/sysroot/usr/include/stdio.h:932,
                 from /usr/include/x86_64-linux-gnu/curl/curl.h:49:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:228:17: error: missing binary operator before token "("
  228 | #if __GLIBC_USE (DEPRECATED_GETS)
      |                 ^
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/curl’
ERROR: dependency ‘curl’ is not available for package ‘credentials’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/credentials’
ERROR: dependency ‘curl’ is not available for package ‘httr2’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/httr2’
ERROR: dependency ‘systemfonts’ is not available for package ‘textshaping’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/textshaping’
ERROR: dependency ‘curl’ is not available for package ‘httr’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/httr’
ERROR: dependency ‘curl’ is not available for package ‘rcmdcheck’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/rcmdcheck’
ERROR: dependency ‘curl’ is not available for package ‘rversions’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/rversions’
ERROR: dependency ‘curl’ is not available for package ‘urlchecker’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/urlchecker’
ERROR: dependency ‘credentials’ is not available for package ‘gert’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/gert’
ERROR: dependency ‘httr2’ is not available for package ‘gh’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/gh’
ERROR: dependencies ‘systemfonts’, ‘textshaping’ are not available for package ‘ragg’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/ragg’
ERROR: dependencies ‘curl’, ‘gert’, ‘gh’ are not available for package ‘usethis’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/usethis’
ERROR: dependencies ‘httr’, ‘ragg’ are not available for package ‘pkgdown’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/pkgdown’
ERROR: dependencies ‘usethis’, ‘pkgdown’, ‘rcmdcheck’, ‘rversions’, ‘urlchecker’ are not available for package ‘devtools’
* removing ‘/home/stud9/miniconda3/envs/gxp/lib/R/library/devtools’

I have tried using remotes but I always get the same

2 Answers2

1

Well, there's quite a bit of useful information in what you posted. Look at this for example:

--------------------------- [ANTICONF] --------------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)

I'm guessing the deb package applies to your case (you're likely based on ubuntu), so:

apt update && apt install -y libcurl4-openssl-dev

... should make install of curl work.

It also wants the file ft2build.h. Looking at my own system it seems libfreetype-dev provides that and fontconfig.pc is from libfontconfig-dev, so:

apt install -y libfreetype-dev libfontconfig-dev

Perhaps this will be enough to make install complete?

Sirius
  • 5,224
  • 2
  • 14
  • 21
  • This is fine for a first take, but in a Conda context shouldn't be necessary. It would be preferable to install the package with Conda (goes by `r-devtools`) and all the dependencies will be handled automatically. – merv Aug 07 '23 at 16:02
0

If using Conda to create R environments, then do not use install.packages. Instead, always install from Conda (or Mamba).

conda create -n r43 r-base=4.3 r-devtools

There is some related information in this answer.

For even better reproducibility, work from a YAML file to create your environment. Here's an example environment for DESeq2 (a common tool for RNA-seq analysis):

deseq2.yaml

name: deseq2
channels:
  - conda-forge
  - bioconda
  - nodefaults
dependencies:
  ## R core
  - r-base=4.3  # always give version
  - r-irkernel  # jupyter interop

  ## CRAN packages
  - r-tidyverse
  - r-pheatmap

  ## Bioconductor packages
  - bioconductor-deseq2
  - bioconductor-tximport

Use this with:

## create 
conda env create -n deseq2 -f deseq2.yaml

## update environment with
conda env update -n deseq2 -f deseq2.yaml
merv
  • 67,214
  • 13
  • 180
  • 245