Celeb Glow
general | March 29, 2026

Cannot install any package in R at Ubuntu 18.04

I have installed R in my Ubuntu (18.04) system and when I try to install a package I receive the following message (for example when trying to install dplyr package):

> install.packages('dplyr')
Installing package into ‘/home/giwrikas/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository cannot open URL '
Warning message:
package ‘dplyr’ is not available (for R version 4.0.2) 

The same error appears with every package. Does anyone know how to solve that ?

It seems that the library is not writable and often appears the following message:

Would you like to use a personal library instead? (y/n) y
Would you like to create a personal library
~/R/pc-linux-gnu-library/3.2
to install packages into? (y/n) y

My R version is 4.0.2. The same R version works fine at windows.Thank you in advance

12

3 Answers

Are you behind a firewall ? I had to add the proxy to my Renviron.site before proceeding on various servers:

sudo nano /usr/lib/R/etc/Renviron.site

#add following, edit to your proxy
http_proxy=
https_proxy=
ftp_proxy=
2

Try to switch to other mirror using the following procedure:

  1. Open terminal and launch R shell
  2. In R shell switch the mirror by chooseCRANmirror() - in opened window choose nearest mirror
  3. In R shell retry package installation with install.packages('dplyr')
1

The newest version of R that you seem to want can be installed without adding software sources to the default repositories starting in Ubuntu 20.10 which won't be released until November. An earlier version of r-cran-dplyr can be installed right now from the default repositories in 18.04, but it drags in r-base-core 3.4.4 as a dependency. Since you can't have both ideal conditions at that same time, you need to start think clearly about what your priorities are. Do you really need the latest version of dplyr to be installed in not the latest version of Ubuntu, or do you have room to maneuver between the conflicting requirements of different package versions?

In Ubuntu 18.04 and later open the terminal and type:

sudo apt update
sudo apt install r-cran-dplyr # installs r-base-core 3.4.4 as a dependency

This GNU R package provides a fast, consistent tool for working with data frame like objects, both in memory and out of memory. r-base-core 4.0 won't land in the default Ubuntu repositories until Ubuntu 20.10.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy