Score:1

Cannot install any R packages after installing Ubuntu 20.04

uz flag

Please are there any hints on why I am not able to install any R packages? I recently installed the Ubuntu 20.04 LTS OS as well as R and R studio. I am however not able to install any packages in R. I have gone through a seemingly related post such as Cannot install any R packages on Ubuntu 18.04 but the solutions appear not to help in my case. For instance, while trying to install the ggplot2 package, I get reports that various dependencies are not installed, but trying to install any one of them does not work at all. I will be grateful for any suggestions.

I have added here the last of the error statements and R session info after trying to install the ggplot2 package, as well as the outputs when I run the commands R --version and apt-cache policy r-base-dev:

install.packages("ggplot2")

* removing ‘/home/power/R/x86_64-pc-linux-gnu-library/4.1/tibble’
Warning in install.packages :
  installation of package ‘tibble’ had non-zero exit status
ERROR: dependencies ‘digest’, ‘glue’, ‘isoband’, ‘rlang’, ‘scales’, ‘tibble’ are not available for package ‘ggplot2’
* removing ‘/home/power/R/x86_64-pc-linux-gnu-library/4.1/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.0 tools_4.1.0 


(base) power@power-SYS-7039A-I:~$ R --version
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

(base) power@power-SYS-7039A-I:~$ apt-cache policy r-base-dev
r-base-dev:
  Installed: 4.1.0-1.2004.0
  Candidate: 4.1.0-1.2004.0
  Version table:
 *** 4.1.0-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
        100 /var/lib/dpkg/status
     4.0.5-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.4-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.3-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.2-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.1-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.0-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     3.6.3-2 500
        500 http://de.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        500 http://de.archive.ubuntu.com/ubuntu focal/universe i386 Packages
(base) power@power-SYS-7039A-I:~$ 
N0rbert avatar
zw flag
Please edit your question to add output of `R --version` and `apt-cache policy r-base-dev`. You are probably missing some development packages for ggplot compilation.
Score:0
zw flag

You have to carefully check R console output while it compiles the packages for you.

On fresh 20.04 LTS with R 4.1, the following actions give success:

sudo apt-get install r-base-dev build-essential 
sudo apt-get install build-essential libssl-dev libcurl4-openssl-dev libxml2-dev libcairo2-dev libgit2-dev

mkdir -p /home/$USER/R/x86_64-pc-linux-gnu-library/4.1
R -e "install.packages(c('rlang','ggplot2'), repos='http://cran.rstudio.com/', lib='/home/$USER/R/x86_64-pc-linux-gnu-library/4.1')"
Charles avatar
uz flag
Thanks a lot. But running the commands lead to the successful installation of `rlang` and `ggplot2` but I am still neither able to install any other package via RStudio nor on the command line with a command such as `R -e "install.packages(c('devtools'), repos='http://cran.rstudio.com/', lib='/home/$USER/R/x86_64-pc-linux-gnu-library/4.1')"`
N0rbert avatar
zw flag
Please share full log of the above command, upload it to pastebin.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.