Issue with installed.packages - Endless loop - "Updating Loaded Packages - One or more of the packages that will be updated by installation are currently loaded. Restarting R prior to updating these packages is strongly recommended"

Hi there,

I have been receiving error msg installing packages. Everytime I run a code it says "Updating Loaded Packages - One or more of the packages that will be updated by installation are currently loaded. Restarting R prior to updating these packages is strongly recommended" and if I click "yes" to it, it goes into a loop. If I decide to skip that code chunk and try run the next code, it gives me error msg saying that it "cound not find function.."

#installing packages
install.packages("ggplot2") 
install.packages("knitr")
install.packages("gridExtra")
install.packages("plyr")
install.packages("dplyr")
library(ggplot2)
library(GGally)
library(gridExtra)
library(dplyr)
library(plyr)
library(memisc)

#removing column X from rwq data
rwq = select(rwq, -1)
2 Likes

You're likely getting this error because you can't attach a library that you haven't installed. The functions are inside of the library, so you'll need to make sure the install succeeds. Try installing the packages in a fresh session.

1 Like

Hi mara,

Thanks for getting back. I re-installed R studio, opened the file and tried installing the packages but still no luck.

It keeps going into this loop:

Restarting R session...

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

is there any issue with my code for not able to install packages or is it something else?

Many thanks,

1 Like

I find that restarting R from this dialog box does not always do the trick. I recommend hitting "Cancel" and then using the keyboard shortcut Ctrl + Shift + F10 to restart your R session. Then retry installing the package.

13 Likes

Right, so you'll have a clean session. You might also want to close out of your .Rmd if you're installing knitr. This could be just a coincidence from one time I was having problems, but I can't imagine it hurts to do.

1 Like

Thanks tbradley and mara i followed both of your advices and now it is installing those packages.

mara - why is it best to close out .rmd when installing knitr?

As I said, I'm honestly not sure if that's a real thing or if it's correlation/superstition.

Hi, @anapy, recently I used to fail to install ggplot2 package with newest version. Here is my general way to fix problem about installling packages (I post here and copy it).

  • In the console, type .libPaths() or find.package (@cderv) and get the package path in your computer.
  • Go to the path and delete the package folder
  • Reuse install.package() function to try.

If in this way, it also fail. I suggest you can install this package from github in the developing version.

2 Likes

Some RStudio IDE feature and UX are build upon some R :package: . It is why you need them, and they can be loaded just because the IDE is open. I observed this with yaml :package: once, that is use to load the list of Rmd templates available in one of the menu.
It may be the case for knitr: This :package: is the foundation for Rmd functionnality and it is possible the Rmd feature in the IDE are built upon knitr being loaded. Not sure but possible.

In all case, one safest way to update all your packages could also be to not open RStudio for that. You open R GUI or just R at command line and run update.packages() there - nothing is loaded and no risk a conflict.

3 Likes

Thanks all! It is working now - much appreciated!

1 Like

Hi everyone,

This could be related to my previous post so I am adding this query here.

I successfully installed packages mentioned previously (except 'knitr') and the code runs without any problem but when I click command for 'knit HTML' , I get this error -


I checked the file location .libPaths(), plyr dplyr and memisc packages are now turn into .dll only. Do you think this is the problem? If so how can I fix it?

Thanks in advance.

This could happen when there is an issue with installation, for example the package being loaded when trying to be installed.

You need to :

  • Delete the directory of the package
  • install the missing package

That should work after that

2 Likes

Hi cderv,

Thank you for your advise. I deleted those folders from the directory and install them again. Which went well but again, after running the 'knit HTML', I got the same message
and I can only see .dll file in the plyr, dplyr, memisc folder..

So I decided to delete the install.packages codes before 'knit HTML' and it worked!

:scream: I did not see that you tried to installed inside rmarkdown code. Don't do that! :slight_smile:

You only need to install a package once. Moreover, as package was already installed and surely loaded in your session, the re-installation caused issue leaving only a dll.

Glad you found your solution!
:

1 Like

I did not know that :flushed: (as you noticed I am a beginner!)

thanks again!!

1 Like

I was trying to update my libraries. At some point, I got an error with 'rlang'. I tried installing it:

> install.packages("rlang")
Error in install.packages : Updating loaded packages

Two complaints here:
a) when I did this with a list, the error message failed to tell me which package(s) out of the list failed.
b) The error message is too vague, I wasn't sure what was wrong or how to fix it. It did occur to me to uninstall and reinstall, which I did.

I should mention the whole thing started with loading another library, which in turn, try to load ggplot2:

> library(Hmisc)     # for minor.tick() used in plotting;
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘rlang’ 0.3.0.1 is already loaded, but >= 0.3.1 is required
Error: package ‘ggplot2’ could not be loaded
> install.packages("ggplot2")

A third problem that occurs, is when I tried to install 'rlang' (without first uninstalling it), I get a message that R needs to be restarted with a restart button. After I click on it, the install fails, then it says I need to restart R... etc.

I'm not sure if this is an R or R Studio problem

I'm a bit behind, so I'll do an update after I post this.
RStudio Version 1.1.456
"R version 3.4.4 (2018-03-15)"
"x86_64-pc-linux-gnu"
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial