Installing rsvg library in R 4.0.2 (conda-forge)

2.1k Views Asked by At

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

1

There are 1 best solutions below

2
On

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.