r-cran-packages on ubuntu repos - r

usually I install R packages from CRAN mirrors, but some of them give me problems. This almost always happens with packages strongly interacting with the system (e.g. rgl, cairoDevices etc). If I well understood when I install packages from the Ubuntu repo with
apt-get install r-cran-rgl
these will be installed in /usr/lib/R/site-library directory. For a number of packages installed in /usr/lib/R/site-library when I do update.packages(ask=FALSE) from R (working under sys admin) I get the following type of messages:
Warning: package 'ggplot2' in library '/usr/lib/R/site-library' will not be updated
I presume that this happens because the version on the cran is newer than the one on the ubuntu repos. But, the rgl package is installed
in '/usr/lib/R/site-library', however when I invoke
update.packages(ask=FALSE)
R download and tries to install a new version of rgl although the one installed is the last one available on ubuntu repos. By the way it tries to install and it fails for some error.
Therefore, what I don't understand is why it doesn't try to update ggplot2 while it tries to update rgl when both have been installed via apt-get and both have the last release number appearing on the ubuntu repos.
Thanks
Pierre

Related

How to install RQDA version in R version 4.02?

How to install RQDA version in R version 4.02?
Warning in install.packages :
package ‘RQDA’ is not available (as a binary package for R version 4.0.2)
You could have a look at the fork at https://github.com/RQDA/RQDA. Since packages that RQDA rely on have been archived on CRAN (RGtk and GtkWidgets), RQDA was archived subsequently.
The official published package has been archived, because of some of its dependencies. However, the package can still be installed from the archives. The steps to do this are as follows:
Install RGtk2 from CRAN.
Install the archived versions of gWidgets and gWidgetsRGtk2. devtools::install_version can do this quite easily when the right arguments are passed to the function. Consult the help file.
Call library(RGtk2) at the R console. You will be prompted to install the GUI library Gtk+, if you don't already have it.
Install the archived version of RQDA from CRAN. If you are using a 64-bit system, you will have to pass the --no-multiarch flag, or else it will fail.
Launch RQDA with library(RQDA).
I have used these steps to successfully install the package on Windows 10 64-bit running R-4.0.3. Others have used a similar algorithm to do it on Linux and Mac with only slight variations.
Since I had to replicate this for some members of my team I wrote an R script that can be used to carry out the installation. You are welcome to try it out.
That said, development on the main RQDA branch has recommenced, so I expect a resolution of this issue in the near future.

Docker build cannot fetch 'R.utils'

In my Dockerfile I have the following lines:
FROM rocker/verse:latest
RUN R -e "install.packages(c('R.utils'), repos = 'https://cran-archive.r-project.org')"
When I run docker build . I got:
> install.packages(c('R.utils'), repos = 'https://cran-archive.r-project.org')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository https://cran-archive.r-project.org/src/contrib:
cannot open URL 'https://cran-archive.r-project.org/src/contrib/PACKAGES'
Warning message:
package ‘R.utils’ is not available (for R version 4.0.2)
I'm new to Docker, not too sure what I'm doing wrong. I put https://cran-archive.r-project.org/src/contrib/PACKAGES in browser and it couldn't load, should I try a different repo URL?
Thanks!
Try any of the advertised mirrors, and they should have the most recent release of R.utils for your version of R-4.0.2.
That CRAN mirror is specifically for old versions of R. Since your version of R (4.0.2) is not old, it is not found there. That cran-archive is intended for R versions without support for those packages (ergo the "archive" label, I suspect).
From the R FAQ 2.10:
Since March 2016, “old” material is made available from a central CRAN archive server (https://CRAN-archive.R-project.org/).
Or perhaps from the R for Mac OS X page:
Package binaries for R versions older than 3.2.0 are only available from the CRAN archive so users of such versions should adjust the CRAN mirror setting (https://cran-archive.r-project.org) accordingly.
Both of these suggest that repos = 'https://cran-archive.r-project.org' should be used for old versions of R, but your error reports R-4.0.2 (not old)
yes, you have to mention the full path to the repo. https://cran.r-project.org/src/contrib/R.utils_2.9.2.tar.gz use this repo link to get R.util.
You can also run the command sudo apt-get install -y r-cran-r.utils to install R.utils

cannot install phytools in ubuntu 18.04 with R 3.6

cannot install phytools
tried with devtools
library(devtools)
install_github("liamrevell/phytools")
and
install.packages("phytools")
I keep getting the same error
ERROR: dependency ‘mnormt’ is not available for package ‘phytools’
and I cannot install mnormt because
package ‘mnormt’ is not available (for R version 3.6.3)
gfortran is already installed in my system
GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
any help is highly appreciated,
thanks
On Ubuntu Linux I cannot get R to update to the latest version (>4.0 at the time of writing), so, like Dirk suggests I have to install an older version of the package, one compatible with the version of R I am running.
My R version is 3.6.3, released feb 2020
I go to the mnormt page and click on "old sources" https://cran.r-project.org/src/contrib/Archive/mnormt/
I see that version 1.5-6 is the most recent release which is prior to my version of R
Following these pages: "Installing older versions of packages" https://support.rstudio.com/hc/en-us/articles/219949047-Installing-older-versions-of-packages I copy the relevant url into this code and run it in R
packageurl <- "https://cran.r-project.org/src/contrib/Archive/mnormt/mnormt_1.5-6.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
Which fixes my problem installing mnormt and also allows packages which depend on it to be installed in the standard way (as far as I tested it)
The current version of mnormt depends on a the current version of R; you chose to remain a version behind.
So just install the previous version of mnormt, for example via
cd /tmp
wget https://cran.r-project.org/src/contrib/Archive/mnormt/mnormt_1.5-7.tar.gz
R CMD INSTALL mnormt_1.5-7.tar.gz
Prefix that last INSTALL command with sudo, or change the permission/group membership of /usr/local/lib/R/site-library, if R tells you it cannot write there.
Once mnormt is installed, proceed with the installation of phytools.
Try to add the tag version to install command, for example: devtools::install_github('cran/mnormt#R-3.0.3')
Check what version you need and replace the tag after the '#'.

R - Installing package with remotes::install_github ask for higher version of the dependencies which BiocManager::install() can not find

I need to install few packages that should be installed with remotes::install_github() like
"acidgenomics/basejump" or "satijalab/seurat".
During the installation, it need to upgrade few other packages version. The BiocManager::install program cannot find those versions and I had to install those dependencies packages version with:
R CMD INSTALL IRanges_2.20.2.tar.gz
Then other packages, that use the same packages stop working. like DESeq2,
I get the error:
Error: package or namespace load failed for ‘DESeq2’:
objects ‘rowSums’, ‘colSums’, ‘rowMeans’, ‘colMeans’ are not exported by 'namespace:S4Vectors'
I found few answers that say it happen (like url)
remotes::install_github() isn't picking up the correct Bioconductor
devel repos, whereas installing with BiocManager::install() does work
as expected.
we have the R 3.6.0 installed as a module and a lot of users uses the same R version. I need all packages to work for everyone.
How can I make all variety packages versions to work?
Finally, I install new version of R 3.6.3 with Bioconductor 3.10 and all the packages install right.

"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.

Resources