joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
798 stars 219 forks source link

Installation error #326

Closed michelefioretti closed 3 years ago

michelefioretti commented 3 years ago

I have an error installing quantmod

The error is described in the following R code

devtools::install_github("joshuaulrich/quantmod")
Downloading GitHub repo joshuaulrich/quantmod@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                        
2: CRAN packages only         
3: None                       
4: zoo (1.8-8 -> 1.8-9) [CRAN]

Enter one or more numbers, or an empty line to skip updates:All
Enter one or more numbers, or an empty line to skip updates:1
zoo (1.8-8 -> 1.8-9) [CRAN]
Installing 1 packages: zoo
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/zoo_1.8-9.tgz'
Content type 'application/x-gzip' length 1027932 bytes (1003 KB)
==================================================
downloaded 1003 KB

The downloaded binary packages are in
    /var/folders/7_/n_pmyvxs5b56zdy5qh4gfmt8x_n_tl/T//RtmpOYlqIA/downloaded_packages
✓  checking for file ‘/private/var/folders/7_/n_pmyvxs5b56zdy5qh4gfmt8x_n_tl/T/RtmpOYlqIA/remotesf8406566184b/joshuaulrich-quantmod-a2aad16/DESCRIPTION’ ...
─  preparing ‘quantmod’:
✓  checking DESCRIPTION meta-information ...
─  installing the package to process help pages
─  saving partial Rd database (5.4s)
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘quantmod_0.4.18.1.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'

* installing *source* package ‘quantmod’ ...
** using staged installation
** R
** demo
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package ‘xts’ was built under R version 3.6.2
Execution halted
ERROR: lazy loading failed for package ‘quantmod’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/quantmod’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/quantmod’
Error: Failed to install 'quantmod' from GitHub:
  (converted from warning) installation of package ‘/var/folders/7_/n_pmyvxs5b56zdy5qh4gfmt8x_n_tl/T//RtmpOYlqIA/filef840456c2f51/quantmod_0.4.18.1.tar.gz’ had non-zero exit status

Could you please help me? Thank you

Session Info

session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       <NA>                        
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Paris                
 date     2021-03-12                  

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 ! package              * version    date       lib source        
   assertthat             0.2.1      2019-03-21 [1] CRAN (R 3.6.0)
   backports              1.1.9      2020-08-24 [1] CRAN (R 3.6.2)
   callr                  3.4.4      2020-09-07 [1] CRAN (R 3.6.2)
   cellranger             1.1.0      2016-07-27 [1] CRAN (R 3.6.0)
   class                  7.3-17     2020-04-26 [1] CRAN (R 3.6.2)
   cli                    2.0.2      2020-02-28 [1] CRAN (R 3.6.0)
   codetools              0.2-16     2018-12-24 [1] CRAN (R 3.6.1)
   colorspace             1.4-1      2019-03-18 [1] CRAN (R 3.6.0)
   crayon                 1.3.4      2017-09-16 [1] CRAN (R 3.6.0)
   curl                   4.3        2019-12-02 [1] CRAN (R 3.6.0)
   desc                   1.2.0      2018-05-01 [1] CRAN (R 3.6.0)
   devtools             * 2.3.1      2020-07-21 [1] CRAN (R 3.6.2)
   digest                 0.6.25     2020-02-23 [1] CRAN (R 3.6.0)
   dplyr                  1.0.2      2020-08-18 [1] CRAN (R 3.6.2)
   ellipsis               0.3.1      2020-05-15 [1] CRAN (R 3.6.2)
   fansi                  0.4.1      2020-01-08 [1] CRAN (R 3.6.0)
   fs                     1.5.0      2020-07-31 [1] CRAN (R 3.6.2)
   furrr                  0.2.2      2021-01-29 [1] CRAN (R 3.6.2)
   future                 1.21.0     2020-12-10 [1] CRAN (R 3.6.2)
   generics               0.1.0      2020-10-31 [1] CRAN (R 3.6.2)
   ggplot2                3.3.2      2020-06-19 [1] CRAN (R 3.6.2)
   globals                0.14.0     2020-11-22 [1] CRAN (R 3.6.2)
   glue                   1.4.2      2020-08-27 [1] CRAN (R 3.6.2)
   gower                  0.2.2      2020-06-23 [1] CRAN (R 3.6.2)
   gtable                 0.3.0      2019-03-25 [1] CRAN (R 3.6.0)
   hms                    0.5.3      2020-01-08 [1] CRAN (R 3.6.0)
   httr                   1.4.2      2020-07-20 [1] CRAN (R 3.6.2)
   ipred                  0.9-10     2021-03-04 [1] CRAN (R 3.6.2)
   jsonlite               1.7.1      2020-09-07 [1] CRAN (R 3.6.2)
   lattice                0.20-41    2020-04-02 [1] CRAN (R 3.6.2)
   lava                   1.6.9      2021-03-11 [1] CRAN (R 3.6.1)
   lifecycle              0.2.0      2020-03-06 [1] CRAN (R 3.6.0)
   listenv                0.8.0      2019-12-05 [1] CRAN (R 3.6.0)
   lubridate            * 1.7.9      2020-06-08 [1] CRAN (R 3.6.2)
   magrittr               1.5        2014-11-22 [1] CRAN (R 3.6.0)
   MASS                   7.3-53     2020-09-09 [1] CRAN (R 3.6.2)
   Matrix                 1.2-18     2019-11-27 [1] CRAN (R 3.6.0)
   memoise                1.1.0      2017-04-21 [1] CRAN (R 3.6.0)
   munsell                0.5.0      2018-06-12 [1] CRAN (R 3.6.0)
   nnet                   7.3-14     2020-04-26 [1] CRAN (R 3.6.2)
   parallelly             1.23.0     2021-01-04 [1] CRAN (R 3.6.2)
   PerformanceAnalytics * 2.0.4      2020-02-06 [1] CRAN (R 3.6.0)
   pillar                 1.4.6      2020-07-10 [1] CRAN (R 3.6.2)
   pkgbuild               1.1.0      2020-07-13 [1] CRAN (R 3.6.2)
   pkgconfig              2.0.3      2019-09-22 [1] CRAN (R 3.6.0)
   pkgload                1.1.0      2020-05-29 [1] CRAN (R 3.6.2)
   prettyunits            1.1.1      2020-01-24 [1] CRAN (R 3.6.0)
   processx               3.4.4      2020-09-03 [1] CRAN (R 3.6.2)
   prodlim                2019.11.13 2019-11-17 [1] CRAN (R 3.6.0)
   ps                     1.3.4      2020-08-11 [1] CRAN (R 3.6.2)
   purrr                  0.3.4      2020-04-17 [1] CRAN (R 3.6.2)
   quadprog               1.5-8      2019-11-20 [1] CRAN (R 3.6.0)
   Quandl                 2.10.0     2019-06-12 [1] CRAN (R 3.6.0)
 R quantmod             * 0.4.18     <NA>       [1] <NA>          
   R6                     2.4.1      2019-11-12 [1] CRAN (R 3.6.0)
   Rcpp                   1.0.5      2020-07-06 [1] CRAN (R 3.6.2)
   readr                  1.3.1      2018-12-21 [1] CRAN (R 3.6.0)
   readxl               * 1.3.1      2019-03-13 [1] CRAN (R 3.6.0)
   recipes                0.1.15     2020-11-11 [1] CRAN (R 3.6.2)
   remotes                2.2.0      2020-07-21 [1] CRAN (R 3.6.2)
   rlang                  0.4.10     2020-12-30 [1] CRAN (R 3.6.2)
   rpart                  4.1-15     2019-04-12 [1] CRAN (R 3.6.1)
   rprojroot              1.3-2      2018-01-03 [1] CRAN (R 3.6.0)
   rsample                0.0.9      2021-02-17 [1] CRAN (R 3.6.2)
   rstudioapi             0.11       2020-02-07 [1] CRAN (R 3.6.0)
   scales                 1.1.1      2020-05-11 [1] CRAN (R 3.6.2)
   sessioninfo            1.1.1      2018-11-05 [1] CRAN (R 3.6.0)
   stringi                1.5.3      2020-09-09 [1] CRAN (R 3.6.2)
   stringr                1.4.0      2019-02-10 [1] CRAN (R 3.6.0)
   survival               3.2-3      2020-06-13 [1] CRAN (R 3.6.2)
   testthat               2.3.2      2020-03-02 [1] CRAN (R 3.6.0)
   tibble                 3.0.3      2020-07-10 [1] CRAN (R 3.6.2)
   tidyquant            * 1.0.3      2021-03-05 [1] CRAN (R 3.6.2)
   tidyr                  1.1.2      2020-08-27 [1] CRAN (R 3.6.2)
   tidyselect             1.1.0      2020-05-11 [1] CRAN (R 3.6.2)
   timeDate               3043.102   2018-02-21 [1] CRAN (R 3.6.0)
   timetk                 2.6.1      2021-01-18 [1] CRAN (R 3.6.2)
   TTR                  * 0.24.2     2020-09-01 [1] CRAN (R 3.6.2)
   usethis              * 1.6.1      2020-04-29 [1] CRAN (R 3.6.2)
   utf8                   1.1.4      2018-05-24 [1] CRAN (R 3.6.0)
   vctrs                  0.3.4      2020-08-29 [1] CRAN (R 3.6.2)
   withr                  2.2.0      2020-04-20 [1] CRAN (R 3.6.2)
   xts                  * 0.12.1     2020-09-09 [1] CRAN (R 3.6.2)
 V zoo                  * 1.8-8      2021-03-09 [1] CRAN (R 3.6.2)

[1] /Library/Frameworks/R.framework/Versions/3.6/Resources/library

 V ── Loaded and on-disk version mismatch.
 R ── Package was removed from disk.
joshuaulrich commented 3 years ago

You need to reinstall xts.

michelefioretti commented 3 years ago

Thank you for the quick reply!

Installing xts from devtools

I get the following issue with xts

devtools::install_github("joshuaulrich/xts")
Downloading GitHub repo joshuaulrich/xts@HEAD
Error: Failed to install 'xts' from GitHub:
  Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

and then the code opens this link

Standard xts installation

I can instead install xts in the standard way, but then I get an error from quantmod

install.packages("xts")
trying URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/xts_0.12.1.tgz'
Content type 'application/x-gzip' length 930515 bytes (908 KB)
==================================================
downloaded 908 KB

The downloaded binary packages are in
    /var/folders/7_/n_pmyvxs5b56zdy5qh4gfmt8x_n_tl/T//RtmpEAXW1l/downloaded_packages
> library(xts)
Loading required package: zoo

Attaching package: ‘zoo’

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

    as.Date, as.Date.numeric

Attaching package: ‘xts’

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

    first, last

Warning messages:
1: package ‘xts’ was built under R version 3.6.2 
2: package ‘zoo’ was built under R version 3.6.2 
> devtools::install_github("joshuaulrich/quantmod")
Downloading GitHub repo joshuaulrich/quantmod@HEAD
✓  checking for file ‘/private/var/folders/7_/n_pmyvxs5b56zdy5qh4gfmt8x_n_tl/T/RtmpEAXW1l/remotesfa1216b10b13/joshuaulrich-quantmod-a2aad16/DESCRIPTION’ ...
─  preparing ‘quantmod’:
✓  checking DESCRIPTION meta-information ...
─  installing the package to process help pages
─  saving partial Rd database (5.5s)
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘quantmod_0.4.18.1.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'

* installing *source* package ‘quantmod’ ...
** using staged installation
** R
** demo
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package ‘xts’ was built under R version 3.6.2
Execution halted
ERROR: lazy loading failed for package ‘quantmod’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/quantmod’
Error: Failed to install 'quantmod' from GitHub:
  (converted from warning) installation of package ‘/var/folders/7_/n_pmyvxs5b56zdy5qh4gfmt8x_n_tl/T//RtmpEAXW1l/filefa12414e1808/quantmod_0.4.18.1.tar.gz’ had non-zero exit status

Could you please help me with that?

joshuaulrich commented 3 years ago

Sorry, I didn't look close enough. The problem is that you're using R-3.6.1 and CRAN only provides builds for the two most recent versions of R. So you either need to build xts from source, or upgrade to at least R-3.6.2 or later. I recommend that you upgrade to R-4.0.4 and update all your packages.

I'm going to close this, since I can't fix it by changing anything in quantmod. But I'm happy to continue to help.