R 3.6.2 incompatibility with Linux Mint 19.3 - r

I know that this is no new question, rather this issue has been raised several times.
I have just switched from Linux Mint 19.1 to 19.3 (new install, not upgrade) and want to install R from scratch.
However, problems arise when I tried to follow this repair guide and in the end, when attempting to run
sudo apt-get install r-base
The terminal replied this
> 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.6.2-1disco) but it is not going to be installed
> Depends: r-recommended (= 3.6.2-1disco) but it is not going to be installed W: Target Packages (Packages) is configured multiple
> times in /etc/apt/sources.list:1 and
> /etc/apt/sources.list.d/additional-repositories.list:2 E: Unable to
> correct problems, you have held broken packages
Now I know that this is a common problem for numerous Linux and R users, and I have read dozens of StackOverflow post regarding this issue. But the problem persists and it is for me nearly impossible to fix, because I have tried to edit the /etc/apt/sources.list and nothing changed.
Any help greatly appreciated!

I got the same problem :
Use deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ for linux mint version 19.3
and not disco (it's for the last version of Ubuntu)

Related

Package ‘stringr’ was installed before R 4.0.0: please re-install it BiocManager Installation path not writeable, unable to update packages

Got the errors
Error : package ‘stringr’ was installed before R 4.0.0: please re-install it and BiocManager Installation path not writeable, unable to update packages:
and further down the road rstudio gave me
/usr/local/lib/R/lib/libR.so not found
I had a similar problem when upgrading from R 3.6 to 4.0 in my Linux box.
I am also answering this because this question is one of the first results google gives when looking for this problem.
It turns out that, even by removing R (apt purge) there is a folder that remains in the system creating a lot of problems for the future installation.
I want to link the GREAT answer that was given here and saved me:
https://askubuntu.com/questions/1219737/installing-ggplot2-for-r-3-6-on-ubuntu-18-04
In Linux systems you should look in:
$ ls /usr/local/lib/R/site-library
If the folder has a list of directories you should remove everything with:
sudo rm -Rf /usr/local/lib/R/site-library
Then reinstall R and all the libraries.
This is a long answer to how to fix these errors but I assume necessary and also tips and tricks included (e.g. don't install R 4.0.2 right now (Jul 25, 2020)). It caused me a lot of pain because there were many more errors that I ran into on the way.
Error : package ‘stringr’ was installed before R 4.0.0: please re-install it and BiocManager Installation path not writeable, unable to update packages:
I removed .RData in my home folder (invisible, use ls -la) This fixed my problem for the installed before R 4.0.0 error, but did not fix my bioconductor problems. I assume it might work if you only had the re-install error.
After many attempts at trying to get my packages to load but only getting these errors, I opted to reinstall R. In R, I ran .libpaths and deleted all the files in each of the directories. I then reinstalled R by downloading R from https://www.r-project.org/ and ran the general compile commands in the downloaded folder ./configure --enable-R-shlib --with-blas --with-lapack make sudo make install. The --enable-R-shlib is needed for rstudio to be able to use R, but the others aren't.
On Jul 25, 2020 I tried to install from apt on ubuntu, but rstudio was not able to find libR.so (error of /usr/local/lib/R/lib/libR.so not found). I tried to compile from source R 4.0.2 with the ./configure --enable-R-shlib which should make the libR.so but this returned an error.
I assume this to be an underlying problem as running ./configure --enable-R-shlib compile from source with R 4.0.0, I got the files and Rstudio opened up (please fix R 4.0.2 and subsequently apt).
I then ran the general
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.11")
to install biocmanager and it finally worked.

r-cran-rquantlib does not install in R 3.6.1 and Debian 9

I have had problems compiling Quantlib for Debian 9 and tried to install r-cran-rquantlib via apt from https://cloud.r-project.org/bin/linux/debian stretch-cran35/
I get the following error which I do not understand since I have both Rcpp and zoo already installed.
$ sudo apt install r-cran-rquantlib
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-rquantlib : Depends: r-cran-rcpp (>= 0.11.0) but it is not going to be installed
Depends: r-cran-zoo but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Is this a version mismatch problem? r-cran-rquantlib installs fine in Debian 10

R 3.6 on debian stretch [duplicate]

This question already has an answer here:
R: Cannot install rJava; what is r-api-3.4?
(1 answer)
Closed 3 years ago.
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?
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
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

"rgdal" installation failed on ubuntu

I use travis to check my R package, it's based on a virtual machine of ubuntu. One of my dependencies is rgdal from CRAN, which cannot be installed correctly on travis.
First it said:
ERROR: dependencies ‘rgdal’ is not available for package ‘my package’
I followed the instruction here, then comes the endless dependencies, I installed one by one, according to the instruction of every trial. Finally I installed packages is as below:
libproj-dev
libcurl4-gnutls-dev
libdap-dev
libgdal-dev
libgdal1h
libhdf5-dev
libhdf5-serial-dev
libgdal-dev
libgdal1-dev
It said I still need to install libhdf5-7 = 1.8.11-3ubuntu1~precise1~ppa1
But when I install package libhdf5-7 = 1.8.11-3ubuntu1~precise1~ppa1, it gives another error:
E: Unable to locate package
E: Unable to locate package 1.8.11-3ubuntu1~precise1~ppa1
E: Couldn't find any package by regex '1.8.11-3ubuntu1~precise1~ppa1'
And it seems no more solutions now.
I wonder how to fix this on travis? Is it a common issue on only travis virtual machine or it could happen on any ubuntu machine? Or the package rgdal has some problems with ubuntu?`
Background:
All my installation above used apt-packages of travis, which is explained as below by travis:
apt_packages: A list of packages to install via apt-get. Common examples here include entries in SystemRequirements. This option is ignored on non-linux builds
As of this week, you can opt into using Ubuntu 14.04 on Travis:
See this blog post from Travis for details
See this .travis.yml where I enable Trusty aka 14.04
Switching to 14.04 may be enough in this case. If not, also note that you can prepare your own .deb packages. I mention this in an blog post from this summer.
As the geospatial packages are a little involved that is probably your best. You would need to know how to build Debian packages, and how to use Launchpad to have them auto-built for you. Both topics have lots of tutorials.

R BayesVarSel on Ubuntu installation

I'm trying to install the BayesVarSel package on a ubuntu 12 box on AWS EC2. It works fine on my windows 7 machine (R 2.15.1).
I've attached a screenshot of the error message. It appears to be an issue with the GNU GSL library. I couldn't find a quick way to install GSL (ie sudo apt-get GSL, etc.) so I wanted to see if others have had a similar issue. I'm open to other packages with similar functionality.
EDIT:
A couple other things I've tried without luck :
I was able to recreate the error with Ubuntu 12.04.1 LTS (desktop) running in VirtualBox.
As #Dirk Eddelbuettel suggested, sudo apt-cache search libgsl produced a useful list of packages. It's not clear why that didn't work on your machine.
I installed libgsl with:
sudo apt-get install libgsl0ldbl
sudo apt-get install libgsl0-dev
Now BayesVarSel compiles and loads without error.
Do
apt-cache search libgsl
and everything should be a little clearer. Those packages have existed longer than either Ubuntu or Amazon EC2 so it really should not take superhuman effort to find them.
And if apt-cache search libgsl is too difficult, try packages.ubuntu.com
where you can search for the package containing the file in your error message (eg /usr/include/gsl/gsl_vector.h) and "Yes, Veronica" you can search for substrings too.
On Fedora the required package can be installed with dnf install gsl-devel.

Resources