3
  • I am unable to install some of the r packages I need. Here is an error message:

    Warning in install.packages : package 'fivethirtyeight' is not available (for R version 3.2.3)
    

My R version is the same that came with my fairly recent OS install.

  • I tried to update R per directions on cran for debian (I'm running Linux Mint 18.2 Sonya).

     apt-get update
     apt-get install r-base r-base-dev
    

    with the error message

    r-base is already the newest version (3.2.3-4). 
    r-base-dev is already the newest version (3.2.3-4).
    

This should not be true-- I'm fairly certain the newest version is 3.5. Around this time Rstudio stopped opening, and I was unable to test the package installation, I anticipate needing to reinstall Rstudio after I have a good version of R.

I noticed that cran predicates their instructions with

With an appropriate entry in /etc/apt/sources.list ... the newest R release including recommended packages can be installed ...

Some other trouble shooting steps I had tried before this (I think it was this question) had also involved editing this, so...

  • I tried modifying /etc/apt/sources.list The file I have now looks like:

     #deb cdrom:[Linux Mint 18.2 _Sonya_ - Release amd64 20170628]/ xenial contrib m$
     deb http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/
     deb http://us.archive.ubuntu.com/ubuntu/ sonya main restricted
    
  • I am still unable to update I'll include the output of apt-get commands below, but it's verbose and I'm hoping no one will need to read through it.

  • What should /etc/apt/sources.list look like?

  • What else am I doing wrong?

    sudo apt-get update
    
    Ign:1 http://packages.linuxmint.com sonya InRelease
    Get:2 http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ 
    [ommited for lack of reputation to post links]...
    Ign:22 http://us.archive.ubuntu.com/ubuntu sonya/restricted Translation-en_US
    Ign:23 http://us.archive.ubuntu.com/ubuntu sonya/restricted Translation-en
    Fetched 4,371 B in 6s (710 B/s)
    Reading package lists... Done
    W: GPG error: http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCAE2A0E115C3D8A
    W: The repository 'http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease' is not signed.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: The repository 'http://us.archive.ubuntu.com/ubuntu sonya Release' does not have a Release file.
    N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/sonya/main/binary-amd64/Packages  404  Not Found [IP: 91.189.91.26 80]
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    
    
    sudo apt-get install r-base r-base-dev
    
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     r-base : Depends: r-base-core (>= 3.5.0-1~stretchcran.0) but it is not going to be installed
          Depends: r-recommended (= 3.5.0-1~stretchcran.0) but it is not going to be installed
     r-base-dev : Depends: r-base-core (>= 3.5.0-1~stretchcran.0) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

P.S. This is my first stackoverflow post. Suggestions for how I could have improved the post are welcome.

Edit at 1:05 Pacific: Neither of the keys in the first two comments work. New error messages below:

kchalk@kchalk-Cin ~ $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
Executing: /tmp/tmp.n3xDeOodv5/gpg.1.sh --keyserver
keyserver.ubuntu.com
--recv-keys
E298A3A825C0D65DFD57CBB651716619E084DAB9
gpg: requesting key E084DAB9 from hkp server keyserver.ubuntu.com
gpg: key E084DAB9: "Michael Rutter <marutter@gmail.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
kchalk@kchalk-Cin ~ $ sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
kchalk@kchalk-Cin ~ $ sudo apt-get update
...Ign:25 http://us.archive.ubuntu.com/ubuntu sonya/restricted Translation-en     
Fetched 190 kB in 6s (30.1 kB/s)                                               
Reading package lists... Done
W: GPG error: http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCAE2A0E115C3D8A
W: The repository 'http://cran.cnr.berkeley.edu/bin/linux/debian stretch-cran35/ InRelease' is not signed.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://us.archive.ubuntu.com/ubuntu sonya Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/sonya/main/binary-amd64/Packages  404  Not Found [IP: 91.189.91.26 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
kchalk@kchalk-Cin ~ $ sudo apt-get install r-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 r-base : Depends: r-base-core (>= 3.5.0-1~stretchcran.0) but it is not going to be installed
          Depends: r-recommended (= 3.5.0-1~stretchcran.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Solution!

The answer I'll mark correct (by Carlos Santillan) said to run:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base

This did not quite solve my problem-- I'll leave my edit with the errors that gave me above in case it happed to anyone else. What did work was commenting out everything in /etc/apt/sources.list and including only the following

deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/

I could then run apt-get update and apt-get install and finally have a sufficiently new verion of R. (the line of Carlos Santillan's answer that adds a key was probably also pretty important here.) In the spirit of citation, varun palekar's answer here is what finally made me realize that having a malformed entry in my sources list would prevent even well formed ones from functioning.

kchalk
  • 53
  • 1
  • 7

2 Answers2

5

For Debian stretch, the following procedure worked for me:

Edit /etc/apt/sources.list adding

deb http://cran.rstudio.com/bin/linux/debian stretch-cran35/

Then install and adding the keys:

sudo apt install dirmngr
sudo apt-key adv --keyserver keys.gnupg.net --recv-key 'E19F5F87128899B192B1A2C2AD5F960A256A04AF'

So update and install R:

sudo apt update
sudo apt install r-base

I got it from https://www.linode.com/docs/development/r/how-to-install-r-on-ubuntu-and-debian/

Adriano Rivolli
  • 2,048
  • 1
  • 13
  • 13
0

Looks like the fivethirtyeight available from Cran is not supported on R 3.2.3

https://cran.r-project.org/web/packages/fivethirtyeight/index.html Version: 0.4.0 Depends: R (≥ 3.2.4) Can you download a newer version of R from Cran?

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt-get update
sudo apt-get install r-base
Carlos Santillan
  • 1,077
  • 7
  • 8