1

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 https://cloud.r-project.org/src/contrib:
  cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
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
  • Please add output of apt-cache policy r-base-dev to the question. This looks strange, as the says that it needs R ≥3.2. Can you open cloud.r-project.org/src/contrib URL from web-browser?
    – N0rbert
    Jul 2, 2020 at 14:28
  • Yes I can open the URL in the browser. I run this command but I can not send you the output because has too many characters. And I can not attach a screenshot here. Also it seems that I can not either send you a personal message because I dont use the premium version. Any ideas ? Thank you in advance Jul 2, 2020 at 15:48
  • For long pastes you can use pastebin.com .
    – N0rbert
    Jul 2, 2020 at 16:01
  • Ok, I used Pastebin. Now, Can I share this link in order for you to check the message? Does it work?pastebin.com/raw/tu1mGdUE Jul 2, 2020 at 16:20
  • R version is correct, could you please run Rscript -e "install.packages('dplyr')" from terminal and upload results to the pastebin too.
    – N0rbert
    Jul 2, 2020 at 17:09

3 Answers 3

1

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=http://myproxy.com:8080
https_proxy=http://myproxy.com:8080
ftp_proxy=http://myproxy.com:8080
2
  • Hi! I just open this file and add these ? -->http_proxy=myproxy.com:8080 https_proxy=myproxy.com:8080 ftp_proxy=myproxy.com:8080 ? If you could share more info about it I would appreciate, because I tried but I don't know if I did the process right, Thanks in advance! Jul 3, 2020 at 15:55
  • You didn't mention if you were behind a proxy ? Also myproxy should be your company or university proxy server. (i.e. not myproxy, that is a placeholder )
    – colindaven
    Jul 5, 2020 at 9:02
0

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
  • This is what I get when trying to change CRAN mirror: > chooseCREANmirror() Error in chooseCREANmirror() : could not find function "chooseCREANmirror" > chooseCRANmirror() Warning: failed to download mirrors file (cannot open URL 'cran.r-project.org/CRAN_mirrors.csv'); using local file '/usr/share/R/doc/CRAN_mirrors.csv' Warning message: In download.file(url, destfile = f, quiet = TRUE) : URL 'cran.r-project.org/CRAN_mirrors.csv': status was 'Couldn't resolve proxy name' > – Jul 3, 2020 at 15:52
-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
  • 1
    These packages are usually outdated. An OP uses R 4.0 from third-party repository.
    – N0rbert
    Jul 3, 2020 at 14:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .