Problem loading ggplot2 Error no package called 'crayon'

Hello, I am trying to use ggplot2 and cannot install the package correctly in Rstudio (Windows). When I try load the package it reads:

Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘crayon’

When I try to install crayon I get this error:

Installing package into ‘C:/Users/david/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
binary source needs_compilation
crayon 1.4.2 1.5.0 FALSE

installing the source package ‘crayon’

trying URL 'https://cloud.r-project.org/src/contrib/crayon_1.5.0.tar.gz'
Content type 'application/x-gzip' length 40099 bytes (39 KB)
downloaded 39 KB

The downloaded source packages are in
‘C:\Users\david\AppData\Local\Temp\RtmpOELFMb\downloaded_packages’
Warning message:
In install.packages("crayon") :
installation of package ‘crayon’ had non-zero exit status

Any help would be much appreciated!

David

The easiest solution is to install the binary version.

Your are trying to install from source which requires compilation and the process is failing. I suspect you have omitted a portion of the console output because there is not much information on what you have posted, can you post the complete console output you get?

Here is the full console output:

library(ggplot2)
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘crayon’
install.packages("crayon")
Installing package into ‘C:/Users/david/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)

There is a binary version available but the source
version is later:
binary source needs_compilation
crayon 1.4.2 1.5.0 FALSE

installing the source package ‘crayon’

trying URL 'https://cran.rstudio.com/src/contrib/crayon_1.5.0.tar.gz'
Content type 'application/x-gzip' length 40099 bytes (39 KB)
downloaded 39 KB

Warning in install.packages :
installation of package ‘crayon’ had non-zero exit status

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

Thanks so much for your help!

try this and report back

install.packages("crayon",type="binary")
1 Like

WORKED! Thank you @nirgrahamuk !!

Got it working thanks @andreasr !!

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.