Packages loading problem

I got those errors for FactomineR and dplyr. And when I try to install ggplot2 and lifecycle, R tells me the packages are currently loaded and ask me if I want to restart a session..

library(FactoMineR)
Erreur : package or namespace load failed for ‘FactoMineR’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
aucun package nommé ‘ggplot2’ n'est trouvé
De plus : Warning message:
le package ‘FactoMineR’ a été compilé avec la version R 4.0.5
library(dplyr)
Erreur : package or namespace load failed for ‘dplyr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
aucun package nommé ‘lifecycle’ n'est trouvé
De plus : Warning message:
le package ‘dplyr’ a été compilé avec la version R 4.0.5

install.packages("lifecycle")
Error in install.packages : Updating loaded packages
install.packages("ggplot2")
Error in install.packages : Updating loaded packages

Indeed, the problem is that dependencies of {ggplot2} seem to be loaded in the current session and it can't be installed. The solution is to first close all instances of RStudio and all R sessions, then open a fresh session, and rerun the install.packages("ggplot2") command.

This should work in RStudio, if this fails open an R session in the terminal, making sure that RStudio is closed.

Or you can try to use pak, it behaves much better when the packages you are trying to install are loaded in this or other R session:

install.packages("pak")
pak::pkg_install("FactoMineR")

should install all dependencies of FactoMineR.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.