rubuntushinygraphicscairo

Getting the Error: Graphics API version mismatch


I'm getting the following error when I run shiny:

Error: Graphics API version mismatch


Listening on http://127.0.0.1:3774
Warning: Error in Cairo: Graphics API version mismatch
  [No stack trace available]

Any idea how to fix it.

My session information is below:

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
 [1] leaflet_2.0.4.1   tidytable_0.6.4   forcats_0.5.1    
 [4] stringr_1.4.0     dplyr_1.0.7       purrr_0.3.4      
 [7] readr_2.0.1       tidyr_1.1.3.9000  tibble_3.1.3     
[10] ggplot2_3.3.5     tidyverse_1.3.1   ggvis_0.4.7      
[13] shiny_1.6.0       rpivotTable_0.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7            lubridate_1.7.10     
 [3] assertthat_0.2.1      digest_0.6.27        
 [5] utf8_1.2.2            mime_0.11            
 [7] R6_2.5.0              cellranger_1.1.0     
 [9] backports_1.2.1       reprex_2.0.1         
[11] httr_1.4.2            pillar_1.6.2         
[13] rlang_0.4.11          readxl_1.3.1         
[15] rstudioapi_0.13       data.table_1.14.0    
[17] jquerylib_0.1.4       htmlwidgets_1.5.3    
[19] munsell_0.5.0         broom_0.7.9          
[21] compiler_4.1.1        httpuv_1.6.1         
[23] modelr_0.1.8          xfun_0.25            
[25] pkgconfig_2.0.3       htmltools_0.5.1.1    
[27] tidyselect_1.1.1.9000 fansi_0.5.0          
[29] crayon_1.4.1          tzdb_0.1.2           
[31] dbplyr_2.1.1          withr_2.4.2          
[33] later_1.2.0           grid_4.1.1           
[35] jsonlite_1.7.2        xtable_1.8-4         
[37] gtable_0.3.0          lifecycle_1.0.0      
[39] DBI_1.1.1             magrittr_2.0.1       
[41] scales_1.1.1          cachem_1.0.5         
[43] cli_3.0.1             stringi_1.7.3        
[45] fs_1.5.0              promises_1.2.0.1     
[47] bslib_0.2.5.1         xml2_1.3.2           
[49] ellipsis_0.3.2        generics_0.1.0       
[51] vctrs_0.3.8           Cairo_1.5-12.2       
[53] tools_4.1.1           glue_1.4.2           
[55] hms_1.1.0             crosstalk_1.1.1      
[57] rsconnect_0.8.24      yaml_2.2.1           
[59] fastmap_1.1.0         colorspace_2.0-2     
[61] rvest_1.0.1           knitr_1.33           
[63] haven_2.4.3           sass_0.4.0  

Solution

  • Starting with R 4.1.0 the graphics engine version has been upgraded. I suspect that may cause the error.

    The R News for 4.1.0 state:

    The graphics engine version, R_GE_version, has been bumped to 14 and so packages that provide graphics devices should be reinstalled.

    So maybe re-installing the Cairo package solves the issue.