Can´t install R packages on Ubuntu 22

Hi, I have problems installing R-packages on Ubuntu 22.04

All the packages that I was trying to install give me similar messages

install.packages("naniar")
Installing package into ‘/home/angelica/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
also installing the dependency ‘norm’

probando la URL 'https://cloud.r-project.org/src/contrib/norm_1.0-11.1.tar.gz'
Content type 'application/x-gzip' length 18954 bytes (18 KB)

downloaded 18 KB

probando la URL 'https://cloud.r-project.org/src/contrib/naniar_1.0.0.tar.gz'
Content type 'application/x-gzip' length 2789372 bytes (2.7 MB)

downloaded 2.7 MB

  • installing source package ‘norm’ ...
    ** package ‘norm’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    using C compiler: ‘gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0’
    sh: 1: gfortran: not found
    gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -ffile-prefix-map=/build/r-base-MHXHhT/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c init.c -o init.o
    gfortran -fpic -g -O2 -ffile-prefix-map=/build/r-base-MHXHhT/r-base-4.3.1=. -fstack-protector-strong -c norm.f -o norm.o
    /bin/bash: línea 1: gfortran: orden no encontrada
    make: *** [/usr/lib/R/etc/Makeconf:214: norm.o] Error 127
    ERROR: compilation failed for package ‘norm’
  • removing ‘/home/angelica/R/x86_64-pc-linux-gnu-library/4.3/norm’
    Warning in install.packages :
    installation of package ‘norm’ had non-zero exit status
    ERROR: dependency ‘norm’ is not available for package ‘naniar’
  • removing ‘/home/angelica/R/x86_64-pc-linux-gnu-library/4.3/naniar’
    Warning in install.packages :
    installation of package ‘naniar’ had non-zero exit status

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

It looks like you need to install gfortran at system level.
apt - How do I install gfortran? - Ask Ubuntu

1 Like

This topic was automatically closed 7 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.