Unable to install ggplot2 package (Error: lazy loading failed ...")

Hi all,

I am a beginner at R and I am trying to install the package "ggplot2", but it does not work.
I get the following error message:

The downloaded binary packages are in
C:\Users\Wagp62\AppData\Local\Temp\Rtmp2NBsX5\downloaded_packages
installing the source package ‘ggplot2’

versuche URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.3.3.tar.gz'
Content type 'application/x-gzip' length 3058840 bytes (2.9 MB)
downloaded 2.9 MB

  • installing source package 'ggplot2' ...
    ** Paket 'ggplot2' erfolgreich entpackt und MD5 Summen überprüft
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Warnung in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]])
    package 'scales' has no 'package.rds' in Meta/
    Fehler in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    Objekt 'pkgInfo' nicht gefunden
    Ruft auf: ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
    Ausführung angehalten
    ERROR: lazy loading failed for package 'ggplot2'
  • removing 'C:/Users/Wagp62/OneDrive - BP/Documents/R/win-library/4.0/ggplot2'
    Warning in install.packages :
    installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
‘C:\Users\Wagp62\AppData\Local\Temp\Rtmp2NBsX5\downloaded_packages’

As I have read several other discussions in this forum, I already tried to install "rlang". I already tried to code "install.packages("ggplot", dependencies = TRUE)" as well.

I do not know what else to do. Can somebody help me? It is really frustrating ...

Best regards

I do not read German so this is a bit of a guess but
package 'scales' has no 'package.rds' in Meta/...
suggests that R cannot find the scales package. Try installing it and retry installing ggplot2

What versions of R, RStudio & Windows?
Welcome to the fun of R.

Thank you for the answer!
I tried it out and the same error message appeared ...

R Studio: R-4.0.3
R: 4.0.3. 64 bit
Windows: Windows 10 64 bit

Scales installed successfully?
Well, that about exhausts my knowledge especially in Windows.

A questions though
Do you have tidyverse installed? If not try installing it. It should install ggplot2 as part of the package.

See https://github.com/tidyverse/ggplot2.

It might be worthwhile trying the development version
devtools::install_github("tidyverse/ggplot2")
as mentioned in the URL. Note that you need to install devtools first at least on Ubuntu.

And as a bit of a long-shot try installing from the Windows R GUI rather than RStudio.

Other than that we probably need someone with some knowledge of R/RStudio in a Windows environment.

Sorry not to be of more help.

It seems your package library is in a cloud synced folder, this brings installation problems very often, I would recommend setting your package library into a non synced folder.

@andresrcs Yes, now it worked. Thank you very much!

This topic was automatically closed 7 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.