dcomtois / summarytools

R Package to Quickly and Neatly Summarize Data
504 stars 77 forks source link

Error loading the package #124

Closed Mohammadreza-raya closed 3 years ago

Mohammadreza-raya commented 4 years ago

Hi,

I am trying to use the package but it cannot be loaded into the R session producing the following error:

> library(summarytools)
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: package or namespace load failed for ‘summarytools’:
 .onLoad failed in loadNamespace() for 'tcltk', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libX11.6.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so
  Reason: image not found

I think tcltk is not supported by R anymore, so I have installed tcltk2 but the result does not change and the summarytools package cannot be loaded.

I even tried to install the package from Github, but did not help:

> library(githubinstall)
> githubinstall("summarytools")
Do you want to install the package (Y/n)?  Y
This package is already installed. Are you sure you want to overwrite it (Y/n)?  Y
✓  checking for file ‘/private/var/folders/3d/340dswf57t7gjf78_0f085v00000gp/T/RtmpZCIgKc/remotes11ee852a83c59/dcomtois-summarytools-9070ef8/DESCRIPTION’ (395ms)
─  preparing ‘summarytools’: (685ms)
✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘summarytools_0.9.7.tar.gz’

* installing *source* package ‘summarytools’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Warning in system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE) :
  running command ''/usr/bin/otool' -L '/Library/Frameworks/R.framework/Resources/library/tcltk/libs//tcltk.so'' had status 1
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libX11.6.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/tcltk/libs/tcltk.so
  Reason: image not found
Execution halted
ERROR: lazy loading failed for package ‘summarytools’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/summarytools’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/summarytools’

Sorry if my question seems quite basic, but I could not troubleshoot it. Would greatly appreciate any help.

Below you can see the current session info:

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] githubinstall_0.2.2 car_3.0-9           carData_3.0-4       psych_2.0.8        
 [5] emmeans_1.5.0       sjPlot_2.8.4        forcats_0.5.0       stringr_1.4.0      
 [9] dplyr_1.0.2         purrr_0.3.4         readr_1.3.1         tidyr_1.1.2        
[13] tibble_3.0.3        ggplot2_3.3.2       tidyverse_1.3.0     afex_0.27-2        
[17] lme4_1.1-23         Matrix_1.2-18      

loaded via a namespace (and not attached):
  [1] minqa_1.2.4         colorspace_1.4-1    pryr_0.1.4          ellipsis_0.3.1     
  [5] rio_0.5.16          rprojroot_1.3-2     sjlabelled_1.1.6    estimability_1.3   
  [9] parameters_0.8.5    base64enc_0.1-3     fs_1.5.0            rstudioapi_0.11    
 [13] farver_2.0.3        remotes_2.2.0       fansi_0.4.1         mvtnorm_1.1-1      
 [17] lubridate_1.7.9     xml2_1.3.2          codetools_0.2-16    splines_4.0.2      
 [21] mnormt_2.0.2        knitr_1.29          sjmisc_2.8.5        pkgload_1.1.0      
 [25] jsonlite_1.7.0      nloptr_1.2.2.2      ggeffects_0.16.0    broom_0.7.0        
 [29] dbplyr_1.4.4        effectsize_0.3.2    compiler_4.0.2      httr_1.4.2         
 [33] sjstats_0.18.0      backports_1.1.9     assertthat_0.2.1    cli_2.0.2          
 [37] prettyunits_1.1.1   htmltools_0.5.0     tools_4.0.2         lmerTest_3.1-2     
 [41] gtable_0.3.0        glue_1.4.2          reshape2_1.4.4      Rcpp_1.0.5         
 [45] cellranger_1.1.0    vctrs_0.3.4         nlme_3.1-148        insight_0.9.5      
 [49] xfun_0.16           ps_1.3.4            testthat_2.3.2      openxlsx_4.1.5     
 [53] rvest_0.3.6         lifecycle_0.2.0     devtools_2.3.1      statmod_1.4.34     
 [57] MASS_7.3-51.6       scales_1.1.1        hms_0.5.3           parallel_4.0.2     
 [61] yaml_2.2.1          curl_4.3            memoise_1.1.0       pander_0.6.3       
 [65] stringi_1.5.3       bayestestR_0.7.2    desc_1.2.0          checkmate_2.0.0    
 [69] pkgbuild_1.1.0      boot_1.3-25         zip_2.1.1           rlang_0.4.7        
 [73] pkgconfig_2.0.3     matrixStats_0.56.0  evaluate_0.14       lattice_0.20-41    
 [77] rapportools_1.0     labeling_0.3        processx_3.4.4      tidyselect_1.1.0   
 [81] plyr_1.8.6          magrittr_1.5        R6_2.4.1            magick_2.4.0       
 [85] generics_0.0.2      DBI_1.1.0           mgcv_1.8-31         pillar_1.4.6       
 [89] haven_2.3.1         foreign_0.8-80      withr_2.2.0         abind_1.4-5        
 [93] performance_0.5.0   modelr_0.1.8        crayon_1.3.4        tmvnsim_1.0-2      
 [97] rmarkdown_2.3       usethis_1.6.1       grid_4.0.2          readxl_1.3.1       
[101] data.table_1.13.0   callr_3.4.3         blob_1.2.1          reprex_0.3.0       
[105] digest_0.6.25       xtable_1.8-4        numDeriv_2016.8-1.1 munsell_0.5.0      
[109] sessioninfo_1.1.1 
dcomtois commented 3 years ago

Hi,

This is almost identical to issue #109. No known solution has been posted for it, but it's hard to imagine that there isn't one... I have no Mac, so I can only offer the same advice as in that previous case: use key parts of the error messages and use them in your google searches. Try putting parts of it within quotes. Try different combinations.

I got this, for instance: https://ma.ttias.be/mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun

Manually installing XCode as suggested there is probably worth a try... Otherwise maybe try asking the question on RStudio's forum, or on StackOverflow maybe.

Hope this helps!

Mohammadreza-raya commented 3 years ago

Thanks a lot for your comment. Using the link you provided, I was able to solve the issue. Firstly, I installed the Xcode toolkit through running the following code in the Terminal: xcode-select --install Afterwards, R instructed me to install XQuartz and the problem was solved. I also found the information here quite useful.

dcomtois commented 3 years ago

Thanks for sharing the solution, glad it worked out!