Problem with ggplot2 package and gtable

I installed the new versions of RStudio (2022.07.1 Build 554) and R-4.2.1 for Windows. When installing the ggplot2 package I get an error message and although it looks installed, it does not run.

This is the error message:

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

I try to install the gtable package, but I fail and it throws this message:

>install.packages("gtable", dependencies = TRUE)

WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/

  There is a binary version available but the source version is later:
       binary source needs_compilation
gtable  0.3.0  0.3.1             FALSE

installing the source package ‘gtable’

trying URL 'https://cran.rstudio.com/src/contrib/gtable_0.3.1.tar.gz'
Content type 'application/x-gzip' length 92733 bytes (90 KB)
downloaded 90 KB


Attaching package: 'dplyr'

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Error: package or namespace load failed for 'ggplot2' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): there is no package called 'gtable'
Ejecución interrumpida
Warning in install.packages :
  installation of package ‘gtable’ had non-zero exit status

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

Thanks

The same ocurr with tidyverse:

> library(tidyverse)
Error: package or namespace load failed for ‘tidyverse’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called ‘gtable’

Installation of the gtable package is failing, please post the complete console output you get when you run this command so we can try to identify the cause.

install.packages("gtable", dependencies = TRUE)
1 Like

It looks like you made need to install Rtools first? RTools: Toolchains for building R and R packages from source on Windows

1 Like

This is the complete console output:

> install.packages("gtable", dependencies = TRUE)
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:

https://cran.rstudio.com/bin/windows/Rtools/
also installing the dependencies ‘lazyeval’, ‘rprojroot’, ‘diffobj’, ‘rex’, ‘brio’, ‘desc’, ‘pkgload’, ‘praise’, ‘waldo’, ‘htmlwidgets’, ‘covr’, ‘testthat’, ‘profvis’


  There is a binary version available but the source version is later:
       binary source needs_compilation
gtable  0.3.0  0.3.1             FALSE

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/lazyeval_0.2.2.zip'
Content type 'application/zip' length 161071 bytes (157 KB)
downloaded 157 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/rprojroot_2.0.3.zip'
Content type 'application/zip' length 109371 bytes (106 KB)
downloaded 106 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/diffobj_0.3.5.zip'
Content type 'application/zip' length 990096 bytes (966 KB)
downloaded 966 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/rex_1.2.1.zip'
Content type 'application/zip' length 126545 bytes (123 KB)
downloaded 123 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/brio_1.1.3.zip'
Content type 'application/zip' length 38206 bytes (37 KB)
downloaded 37 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/desc_1.4.1.zip'
Content type 'application/zip' length 325596 bytes (317 KB)
downloaded 317 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/pkgload_1.3.0.zip'
Content type 'application/zip' length 175452 bytes (171 KB)
downloaded 171 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/praise_1.0.0.zip'
Content type 'application/zip' length 19850 bytes (19 KB)
downloaded 19 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/waldo_0.4.0.zip'
Content type 'application/zip' length 102134 bytes (99 KB)
downloaded 99 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/htmlwidgets_1.5.4.zip'
Content type 'application/zip' length 905066 bytes (883 KB)
downloaded 883 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/covr_3.6.1.zip'
Content type 'application/zip' length 334692 bytes (326 KB)
downloaded 326 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/testthat_3.1.4.zip'
Content type 'application/zip' length 2086063 bytes (2.0 MB)
downloaded 2.0 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/profvis_0.3.7.zip'
Content type 'application/zip' length 186195 bytes (181 KB)
downloaded 181 KB

package ‘lazyeval’ successfully unpacked and MD5 sums checked
package ‘rprojroot’ successfully unpacked and MD5 sums checked
package ‘diffobj’ successfully unpacked and MD5 sums checked
package ‘rex’ successfully unpacked and MD5 sums checked
package ‘brio’ successfully unpacked and MD5 sums checked
package ‘desc’ successfully unpacked and MD5 sums checked
package ‘pkgload’ successfully unpacked and MD5 sums checked
package ‘praise’ successfully unpacked and MD5 sums checked
package ‘waldo’ successfully unpacked and MD5 sums checked
package ‘htmlwidgets’ successfully unpacked and MD5 sums checked
package ‘covr’ successfully unpacked and MD5 sums checked
package ‘testthat’ successfully unpacked and MD5 sums checked
package ‘profvis’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\camil\AppData\Local\Temp\Rtmp8iePcm\downloaded_packages
installing the source package ‘gtable’

trying URL 'https://cran.rstudio.com/src/contrib/gtable_0.3.1.tar.gz'
Content type 'application/x-gzip' length 92733 bytes (90 KB)
downloaded 90 KB


Attaching package: 'dplyr'

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Error: package or namespace load failed for 'ggplot2' in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called 'gtable'
Ejecución interrumpida
Warning in install.packages :
  installation of package ‘gtable’ had non-zero exit status

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

I installed Rtools first. Now I uninstalled everything and reinstalled again (Rtools first, RStudio then) and the same problem continues.

Ok, not being a developer, I'm not sure how to interpret this, but am hopeful someone else will be able to assist. Sorry the reinstall didn't work!

This is weird, for some reason R is trying to compile gtable from source even if RTools is not properly installed.

What version of RTools are you installing? Are you changing any of the default options while installing it?

I installed the last version from https://cran.rstudio.com/bin/windows/base/R-4.2.1-win.exe. When selecting the path where to install RTools, I selected a path other than my operating system (C:/), which has more memory capacity. Everything else was default.

I reinstalled RTools and RStudio in C:/, but the problems continue. When I open RStudio, automatically send this message:

R version 4.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.


Attaching package: ‘dplyr’

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

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

This is a link to R not RTools, just to be specific about this, you need to install RTools42 from here
https://cran.r-project.org/bin/windows/Rtools/rtools42/rtools.html

Also it seems dplyr is being loaded on startup and that can cause this kind of problems, have you modified any . Rprofileor Rprofile.site file? Or are you restoring your previous environment on startup?

Thank you, I got confused. Now I installed it and restarted everything, but nothing has changed. I have not modified anything, I installed everything from scratch and started RStudio, installing ggplot and the error messages remain.

I would really appreciate your help, I've been at a standstill for hours without being able to move forward.

Let's check some possible causes for dplyr being loaded on startup.

  • Disable the "Restore .RData into workspace at startup" option

  • Check the content of C:\Program Files\R\R-4.2.1\etc\Rprofile.site and see if there is any command there that could be loading dplyr.

  • Look for any .Rprofile file located in your HOME folder (i.e. C:\Users\<< your user name>>\Documents), in your default working directory or in your current working directory and delete it (or rename it if you want to keep the content).

1 Like

I deleted .Rprofile file and dplyr stopped loading.

Great, are you able to install gtable now?

Yes!!! All works fine!! 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.