Install R Markdown failing to install in Linux (linux mint /ubuntu)

When I try to install, the following message appears:
"Creating R Markdown documents requires updated versions of the following packages: digest, markdown, stringr, yaml, Rcpp, htmltools, knitr, jsonlite, base64enc, mime, rmarkdown.

Do you want to install these packages now? yes/no"

But none of these packages can be installed. I tried to install by command and downloading the compressed packages, but none of the packages are installed and several error messages appear. It seems to have problems with the dependencies, ‘markdown’, ‘knitr’, ‘mime’

Here are just a few of the messages that appeared when I tried to install the digest package:
/bin/bash: linha 2: g++: command not found
/usr/share/R/share/make/shlib.mk:6: recipe for target 'jsonlite.so' failed
make: *** [jsonlite.so] Error 127
ERROR: compilation failed for package ‘jsonlite’

  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/jsonlite’
    Warning in install.packages :
    installation of package ‘jsonlite’ had non-zero exit status
  • installing source package ‘mime’ ...
    ** package ‘mime’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rawmatch.c -o rawmatch.o
    g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mime.so init.o rawmatch.o -L/usr/lib/R/lib -lR
    /bin/bash: linha 2: g++: comando não encontrado
    /usr/share/R/share/make/shlib.mk:6: recipe for target 'mime.so' failed
    make: *** [mime.so] Error 127
    ERROR: compilation failed for package ‘mime’
  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/mime’
    Warning in install.packages :
    installation of package ‘mime’ had non-zero exit status
    ERROR: dependency ‘mime’ is not available for package ‘markdown’
  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/markdown’
    Warning in install.packages :
    installation of package ‘markdown’ had non-zero exit status
    ERROR: dependencies ‘digest’, ‘Rcpp’, ‘rlang’ are not available for package ‘htmltools’
  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/htmltools’
    Warning in install.packages :
    installation of package ‘htmltools’ had non-zero exit status
    ERROR: dependencies ‘glue’, ‘stringi’ are not available for package ‘stringr’
  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/stringr’
    Warning in install.packages :
    installation of package ‘stringr’ had non-zero exit status
    ERROR: dependencies ‘markdown’, ‘stringr’, ‘yaml’ are not available for package ‘knitr’
  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/knitr’
    Warning in install.packages :
    installation of package ‘knitr’ had non-zero exit status
    ERROR: dependencies ‘knitr’, ‘yaml’, ‘htmltools’, ‘base64enc’, ‘jsonlite’, ‘mime’, ‘stringr’ are not available for package ‘rmarkdown’
  • removing ‘/home/evander/R/x86_64-pc-linux-gnu-library/3.4/rmarkdown’
    Warning in install.packages :
    installation of package ‘rmarkdown’ had non-zero exit status

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

It seems you are missing some development tool on your computer. g++ is not found but is required to install :package: from source on linux.
Look as this documentation to find advice
https://cran.r-project.org/bin/linux/ubuntu/

like

Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package:

sudo apt-get install r-base-dev

About ubuntu, you can also find some binary package useful. See the same doc.

hope it helps.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

It worked, thank you very much

1 Like