Where are the R packages from previously installed versions? - r

After upgrading to R 3.6.2 I am getting a series of errors about earlier versions of libraries being used :
Error: package ‘stringi’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Execution halted
I have worked through several of these via
install.packages('stringi')
but that just leads down the rabbit hole to the next mismatched library. What I'd like to do is en-masse upgrade the existing libraries. Here is a suggestion to use:
lib_loc <- "<old R library path"
to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"])
to_install
install.packages(pkgs = to_install)
However - where is the <old R library path> on ubuntu?
Update Based on suggestion from #RuiBarradas I ran:
update.packages(ask=FALSE)
But the "different internals" errors shown above still happens for many packages. So I am still looking for an answer to how to upgrade the ones installed on the older version of R (3.4.4)

Following did the trick - thanks to #RuiBarradas for the pointer to update.packages:
update.packages(checkBuilt=TRUE, ask=FALSE)

Related

R studio install package failed

I tried to install the packages in the following way:
pacman::p_load(tidyverse, lubridate, zoo,
timetk, modeltime,
trelliscopejs, seasonal,
tsibble, feasts, fable)
However, I got the below errors:
I'm not sure what's wrong, I'm using the latest R version 4.2.1, the warning seems to suggest that need to change to 4.1.3, is there anyway to install those packages without changing the version?
The problem is not related to the package in itself. The warning about the version only tells you that the last time this package was built was on R 4.1.3, but it should work on R 4.2.
The problem is that the place where R searches this package doesn't exist. If you go here: https://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/, you will see that the last version of R is 3.4, whereas you're looking for a package built in R 4.1 (see the version in the URL address in the error message).
Here's some advice to solve this (I can't reproduce your problem so I can't be sure this works): if you're using RStudio, go to "Tools -> Global Options -> Packages". I think that under "Primary CRAN repository", there should be the name of the current place where R searches for the files to install each package. You can change this: either pick "Global (CDN) - RStudio" or any other that is not too far from your location. Then restart R and try reinstalling the packages.

Tidyverse not installing

I'm having a bit of a pickle right now with the package tidyverse, that I need for an assignment on layering maps. I tried installing the package using install.packages("tidyverse") and install.packages ("tidyverse", dependencies = TRUE) but when I ran library(tidyverse) it wasn't installed. I searched online and found that I had an older version of RStudio IDE so I uploaded the latest version (1.3.1056).
After installing the newest version, I reinstalled the package but R tells me the following:
"Rtools is required to build R packages but is not currently
installed".
So, I did it, but the R tells me Rtools package is not available for R version 3.5.3.
What can I do to use tidyverse?
It could be a permissions issue, try setting the directory for where you install R packages/libraries on your computer using libpaths. I have to do this on my work laptop because the university has it set up to store things like this in a tempporary directory on the remote server which isn't desirable.
.libPaths("C:/R")
.libPaths()

update.packages fails to update existing packages built for old version of R

After upgrading R from 3.6.2 to 4.0.1, I used update.packages(pkgs, checkBuilt=T, ask=F) command to update existing packages to the new version. While I expected the command to build/install existing packages for R 4.0.1, the command did not rebuild existing packages that were built/installed for R 3.6.2 and were available for R 4.0.1. However, I was able to use install.packages command to build/install existing packages for R 4.0.1; see here for my current solution. Have others encountered this issue?
I had the same issue. I'm not sure you can use checkBuilt = T to update some packages built for older major releases of R. I wiped my R library and installed everything I needed again.

R 3.5 package ‘lattice’ was installed by an R version with different internals

I updated R 3.4.4 to R 3.5.0 today. And my package cannot pass R CMD check anymore. It fails at checking whether package can be installed ... ERROR.
In another hand my package works, I can install it and use it as long as I don't check it.
The error is the following:
Error: package or namespace load failed for ‘sp’:
package ‘lattice’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Error : package ‘sp’ could not be loaded
I tried to reinstall lattice these ways:
sudo apt-get --reinstall install r-cran-lattice
or
remove.packages("lattice", lib="~/R/x86_64-pc-linux-gnu-library/3.5")
install.package("lattice")
The package lattice is installed correctly in both cases. But it does not solve my problem. Also I ensured to have a single version of lattice removing either the r-cran one or the self compiled version. Nothing works.
Edit By the way I can do library(sp) or library(lattice) it works. But not with R CMD check
The error message tells you that the binary you are attempting to install comes from an insufficient / incompatible R version.
Two fixes:
Install from source as you did. After that check with AP <- available.packages() that you really only have one.
Use the correct binarie: read this README at CRAN and switch to Michael's 'R 3.5' repos. Many of us have been doing that for weeks.
Lastly, the r-sig-debian list is a friendly place for these questions and more. Subscribe first so that you can post.

travis error: "package ‘devtools’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version"

I receive the following error from Travis after doing a git push:
Installing R packages from GitHub: jimhester/covr
$ Rscript -e 'devtools::install_github(c("jimhester/covr"),
build_vignettes = FALSE)'
Error: package ‘devtools’ was installed by an R version with different
internals; it needs to be reinstalled for use with this R version
Execution halted
More information you can find here:
https://travis-ci.org/bozmik/genomation/jobs/315357710#L1125
Do you have any idea how to solve this issue?
You can add
r_packages:
- devtools
before
r_github_packages:
- jimhester/covr
This solve my problem.
I've encountering this issue separately and unfortunately Chaoran's solution didn't work for me.
The problem is that the devtools binary being called from the package cache was built under a different version of R than the one that Travis is using.
I was able to fix this by adding
r: devel
to my .travis.yml, forcing Travis to use the development version of R instead of the release channel. The devtools binary that's causing the problem has been compiled on this devel channel.

Resources