2

I'm facing difficulties downloading the r package rsvg. I created first an environment with conda for the latest R version 4.0.2 following these instructions. I was able to download many other R packages & bioconductor packages without problem, however, this one produces huge pile of lines while configuring it and ends with errors downloadind its dependencies (systemfonts, stringi, stringr, gdtools, magick, svglite, knitr). My exact command is install.packages("rsvg", dependencies =T). Trying to download each of those packages produced also a tree of required dependencies (with configuration fail at the end of each).

Among the lines I noticed this error /user/include/freetype2/freetype/config/ftheader.h:3:12: fatal error x86_64-linux-gnu/freetype2/config/fthreader.h no such file or directory which make me suspect that my R installation is incopmlete or corrupted. I tested it with other R versions (e.g. R 3.6.0) yet the same error appear. Installing it on windows (Rstudio 3.6.2) also didn't work, and now I'm wondering if this package needs to be installed differently or it is system related problem? Any help would be highly appreciated

H.Hasani
  • 79
  • 1
  • 8
  • When you install with R's `install.packages` function you have to make sure that you install all non-R dependencies into the conda environment manually. The error you posted hints towards `freetype` not being installed. You would get it via `conda install freetype`. – cel Jul 31 '20 at 19:54
  • unfortunately that didn't work, I installed first freetype as you kindly suggested, but I still got the same error (I updated the error). It seems whenever I try to download any R package that relys on fonts this error appears. I also downloaded freetype2 by following [1] and the outcome was: no new packages were installed, i.e. it is there but somehow this ftheader file is pointing to another that doesn't exist. [1] http://ubuntuhandbook.org/index.php/2017/06/install-freetype-2-8-in-ubuntu-16-04-17-04/ – H.Hasani Aug 18 '20 at 15:02
  • 3
    I agree that it looks like a library issue. My experience has been that using most of the standard R routes to install packages (`install.packages`, `BioManager::install`, or `devtools::*_install`) are prone to this problem because they are unaware of how Conda manages the dependencies. Personally, my workflow for Conda-managed R instances is to always use Conda to install R packages, e.g., `conda install -c conda-forge r-rsvg`, which I would note has a dependency on `librsvg`. – merv Aug 18 '20 at 23:21
  • thank you very much, that worked & rsvg is now installed. – H.Hasani Aug 25 '20 at 08:31

1 Answers1

0

You need to create a new environment and then you can install R 4.+ in Anaconda. Follow these steps.

conda create --name r4-base

enter image description here

After activating r4-base run these commands

conda install -c conda-forge r-base
conda install -c conda-forge/label/gcc7 r-base

Finally, you will notice r-basa version 4 will be installed.

enter image description here

Thereafter, you can install any supported packages. But with this only, you won't have the ability to use it in the Jupyter notebook. You need to install install.packages('IRkernel') and Jupyter notebook as well if you want to use it. Otherwise you are good to go with R-Studio.

For Jupyter Installation and RKernel.

conda install jupyter

Then open the R console. Write in R console

install.packages('IRkernel')
IRkernel::installspec()

Congrats! You can use Notebook for Python and R.

Rheatey Bash
  • 779
  • 6
  • 17