Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R 3.6 on debian stretch [duplicate]

I need to run 3.6 on debian stretch - I followed the instructions here:

https://cran.r-project.org/bin/linux/debian/

and used this repo:

http://lib.stat.cmu.edu/R/CRAN/bin/linux/debian stretch-cran35/

I was able to install it. But 2 packages I need, r-cran-caret and r-cran-ggplot2 will not install:

# apt-get install r-cran-ggplot2
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-cran-ggplot2 : Depends: r-api-3
                  Depends: r-cran-digest but it is not going to be installed
                  Depends: r-cran-gtable (>= 0.1.1) but it is not
going to be installed
                  Depends: r-cran-plyr (>= 1.7.1) but it is not going
to be installed
                  Depends: r-cran-reshape2 but it is not going to be installed
                  Depends: r-cran-scales (>= 0.4.1) but it is not
going to be installed
                  Depends: r-cran-tibble but it is not going to be installed
                  Depends: r-cran-lazyeval but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Is there a way to get these 2 packages for my environment?

like image 265
Larry Martell Avatar asked Aug 01 '19 16:08

Larry Martell


2 Answers

I am not sure if this will solve your problem.

sudo dpkg --configure -a

In these cases I find it easier to use aptitude

sudo apt install aptitude    
sudo aptitude install r-cran-ggplot2

of course you can try the same with caret if ggplot2 works.

A question is however if you load R in a terminal and try to install these packages within R what kind of error messages do you get, if you get any?

type R in a terminal and after it loads type

install.packages("ggplot2",dependencies=TRUE)

what error messages do you get when you do that?

Another common problem is that the version of a package you are trying to install does install in the version of R you are using. In that case you have to download the package from cran, untar it and install from local files.

open a terminal and type R then inside the session type

packageurl <- "https://cran.r-project.org/src/contrib/ggplot2_3.2.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source", dependencies=TRUE)

If you have the common problem of versioning this command will hopefully not bother checking the version of ggplot and the version of R.

Alternatively if you do not want to explicitly start an R session type in terminal

wget https://cran.r-project.org/src/contrib/ggplot2_3.2.0.tar.gz
R CMD INSTALL ggplot2_3.2.0.tar.gz repos=NULL type="source" dependencies=TRUE
like image 152
Dimitrios Zacharatos Avatar answered Nov 09 '22 22:11

Dimitrios Zacharatos


You're missing dependencies and apt-get tells you that these are broken. You need to remove the broken dependencies from your R library, which should be in /usr/lib/R/site-library.

Why don't you just install it directly within R?

install.packages(c("caret", "ggplot2"), dependencies = TRUE)

As you have mentioned you want to use docker: See the littler package by Dirk Eddelbuettel: https://github.com/eddelbuettel/littler especially install2.r function and it's option -d

For examples how others use it see the rocker docker images.

Another edit: If you decide to use littler, I think you'll need this syntax

install2.r -d TRUE caret ggplot2
like image 36
RBirkelbach Avatar answered Nov 09 '22 20:11

RBirkelbach