Installing ggplot2: “not a valid package” error (Windows, R 3.3)

Split from: Error installing ggplot2 - Error : object ‘enexprs’ is not exported by 'namespace:rlang' ERROR: lazy loading failed for package ‘ggplot2’


Hi rather than start a new thread i'll just re-use this. I've tried all the above and more to get ggplot2 installed - all without success.
System spec below
Any other suggestions ???

platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 3.3

library(ggplot2)
Error in library(ggplot2) : ‘ggplot2’ is not a valid installed package

.libpaths()
"C:/Program Files/R/R-3.3.3/library"

Hi @serge! Welcome!

Since your problem is not identical (it apparently needs its own solution), it is better if you start a new topic. You can link to any previous related topics if you want to clarify what you’ve already read/tried. In keeping with this philosophy, I’m moving your post to its own topic.

To your specific problem:

The key thing to include when seeking help for package installation issues is all of the console output you see when you try to install the package. To share that here, you should copy and paste it from the console (no screenshots please!) and use the little </> button at the top of the posting box to format the output as code. This makes it easier for helpers to read and keeps the forum software from garbling it.

Another thing that is often helpful is the output of running sessionInfo(). Same rules for copy-pasting and formatting apply.

Without seeing the console output you get when you try to install ggplot2, I can’t say for sure what’s wrong, but here are a few things to try:

  • Always restart your R session (RStudio Session menu) before and after installing packages
  • Given the error message above, you may have a failed ggplot2 installation that needs to be cleaned up. Try running remove.packages("ggplot2"), and then try installing again. If remove.packages() doesn’t work, you may need to go look for the ggplot2 folder in your library and delete it yourself.
  • You seem to be running a version of R that is 2 years old. Pre-compiled packages are no longer made available for older versions of R, so the longer you run old versions of R, the more likely it is that you will have to compile packages or their dependencies from source. On Windows, this often requires having the RTools installed (a set of external software tools for building R and R packages from source). Unless you have a very good reason for running older R, I recommend updating R and then trying all of this again. Your package installation life will generally be much easier if you keep R itself updated.
2 Likes