0

I am trying to install ggplot2 package in R and getting following error. kindly let me know what's wrong. I have reinstalled R also but nothing is working. Anyone please help. Thanks in advance.

> install.packages("ggplot2")
Installing package into ‘C:/Users/HP/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
        binary source needs_compilation
ggplot2  3.3.5  3.3.6             FALSE

installing the source package ‘ggplot2’

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

* installing *source* package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  namespace 'rlang' 0.4.11 is already loaded, but >= 1.0.0 is required
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'ggplot2'
* removing 'C:/Users/HP/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\HP\AppData\Local\Temp\Rtmpk7jY7e\downloaded_packages’
Phil
  • 7,287
  • 3
  • 36
  • 66
Abbas waseem
  • 1
  • 1
  • 3
  • 1
    Restart R then make sure to run `install.package("ggplot2")` before anything else. Make sure you don't have any code that auto-loads packages at startup. The error is because `rlang` needs up be updated but you currently have it loaded in your session. – MrFlick May 09 '22 at 20:31
  • `Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : namespace 'rlang' 0.4.11 is already loaded, but >= 1.0.0 is required` this error indicates to me that you should restart r completely and install `rlang` v 1.0.0 or higher and then install `ggplot2` – Mike May 09 '22 at 20:31

0 Answers0