Creating Phylogenetic Trees using ggtree: "caller_env" error, unable to run.

Unable to get the ggtree() function working, even though it worked originally.

Whenever I run the code (see below) I get the following error:

Error in DataMask$new(.data, caller_env) :
argument "caller_env" is missing, with no default

Advice from other forums suggest it's an issue with the version of "dplyr" -however I've seen ggtree run without error on another machine that runs Version 1.0.6 of dplyr so I'm unconvinced this is the problem.

Have tried the following (several times) all without joy:

  • reinstall all packages;
  • uninstall R and Rstudio then reinstall;
  • rolled back dplyr from 1.0.6 to 1.0.4;
  • praying to Zeuss.

Any suggestions greatly appreciated.


tree <- rtree(50)

Here's what I get.

# BiocManager::install("ggtree")
#> Registered S3 method overwritten by 'treeio':
#>   method     from
#>   root.phylo ape
#> ggtree v2.2.4  For help:
#> If you use ggtree in published research, please cite the most appropriate paper(s):
#> e[36m-e[39m Guangchuang Yu. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics, 2020, 69:e96. doi:10.1002/cpbi.96
#> e[36m-e[39m Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution 2018, 35(12):3041-3043. doi:10.1093/molbev/msy194
#> e[36m-e[39m Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. Methods in Ecology and Evolution 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
tree <- rtree(50)

#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Pop!_OS 20.10
#> Matrix products: default
#> BLAS:   /usr/local/lib/R/lib/
#> LAPACK: /usr/local/lib/R/lib/
#> 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            
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> other attached packages:
#> [1] ggtree_2.2.4
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.6          BiocManager_1.30.15 pillar_1.6.1       
#>  [4] compiler_4.0.4      highr_0.9           tools_4.0.4        
#>  [7] digest_0.6.27       aplot_0.0.6         jsonlite_1.7.2     
#> [10] tidytree_0.3.3      evaluate_0.14       lifecycle_1.0.0    
#> [13] tibble_3.1.2        nlme_3.1-152        gtable_0.3.0       
#> [16] lattice_0.20-44     pkgconfig_2.0.3     rlang_0.4.11       
#> [19] reprex_2.0.0        DBI_1.1.1           rvcheck_0.1.8      
#> [22] patchwork_1.1.1     yaml_2.2.1          parallel_4.0.4     
#> [25] xfun_0.23           treeio_1.12.0       dplyr_1.0.6        
#> [28] withr_2.4.2         styler_1.4.1        stringr_1.4.0      
#> [31] knitr_1.33          generics_0.1.0      fs_1.5.0           
#> [34] vctrs_0.3.8         tidyselect_1.1.1    grid_4.0.4         
#> [37] glue_1.4.2          R6_2.5.0            fansi_0.4.2        
#> [40] rmarkdown_2.8       farver_2.1.0        tidyr_1.1.3        
#> [43] purrr_0.3.4         ggplot2_3.3.3       magrittr_2.0.1     
#> [46] backports_1.2.1     scales_1.1.1        ellipsis_0.3.2     
#> [49] htmltools_0.5.1.1   assertthat_0.2.1    colorspace_2.0-1   
#> [52] ape_5.5             labeling_0.4.2      utf8_1.2.1         
#> [55] stringi_1.6.1       lazyeval_0.2.2      munsell_0.5.0      
#> [58] crayon_1.4.1

Thanks Technocrat, that's exactly what I obtained the first time I ran it. Since then, though, I only get the aforementioned error. Advice from elsewhere suggests that the Dplyr version is the issue - most current is 1.0.6 which is what I am running. I see you are running the same version, so clearly this is not the issue.

Here's the error:

Error in DataMask$new(.data, caller_env) :
argument "caller_env" is missing, with no default

I normally enjoy an interesting problem, but this one is driving me to drink :slight_smile:
Thanks again.

1 Like

Things that come to mind

  • Whether running from a fresh session
  • Whether running under a root or ordinary user with different versionings (check with SessionInfo()



to see which and then retry?

THanks - nothing obviously wrong here, though, from what I can see.....

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252

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

other attached packages:
[1] devtools_2.4.1 usethis_2.0.1 ggtree_2.4.2

loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 pillar_1.6.1 compiler_4.0.5 BiocManager_1.30.15 remotes_2.3.0
[6] prettyunits_1.1.1 tools_4.0.5 testthat_3.0.2 pkgload_1.2.1 pkgbuild_1.2.0
[11] aplot_0.0.6 memoise_2.0.0 jsonlite_1.7.2 tidytree_0.3.3 lifecycle_1.0.0
[16] tibble_3.1.1 nlme_3.1-152 gtable_0.3.0 lattice_0.20-41 pkgconfig_2.0.3
[21] rlang_0.4.11 cli_2.5.0 rvcheck_0.1.8 patchwork_1.1.1 parallel_4.0.5
[26] treeio_1.14.4 fastmap_1.1.0 withr_2.4.2 dplyr_1.0.6 desc_1.3.0
[31] generics_0.1.0 vctrs_0.3.8 fs_1.5.0 rprojroot_2.0.2 grid_4.0.5
[36] tidyselect_1.1.1 glue_1.4.2 R6_2.5.0 processx_3.5.2 fansi_0.4.2
[41] sessioninfo_1.1.1 callr_3.7.0 ggplot2_3.3.3 purrr_0.3.4 tidyr_1.1.3
[46] magrittr_2.0.1 ps_1.6.0 scales_1.1.1 ellipsis_0.3.2 ape_5.5
[51] colorspace_2.0-1 utf8_1.2.1 lazyeval_0.2.2 munsell_0.5.0 cachem_1.0.4
[56] crayon_1.4.1

Mysterious. I hope it’s not a Windows artifact (because I can’t help there). This may have something to do with deep rlang voodoo. I’ll check tomorrow to see if I can find a scent.


Solution as follows from the developer:

Please also update tidytree by remotes::install_github("YuLab-SMU/tidytree") . This is beacuse the mutate.tbl_tree in tidytree was not updated in old version.

I also rolled back dplyr from 1.0.6 to 1.0.5 as per his instructions. Not sure whether the tidytree change would have been suffcient,, and I'm not brave enough to try.

1 Like

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.