Have trouble loading in 'Forecast' package

I tried to install and load in 'forecast' package, when I run the library (forecast), this is what it reads:
Error: package or namespace load failed for ‘forecast’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘TTR’

And when I tried to install and load in 'TTR', it shows message reading:
Error in library(TTR) : there is no package called ‘TTR’

And when I tried "install.packages("forecast", dependencies = TRUE)
library(forecast)"... it doesn't work here either. It shows the same as errors:
Error: package or namespace load failed for ‘forecast’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘TTR’
Note: I'm using the latest version of R (released on the first of November, 2021).
I'll appreciate if someone could help me figure out the issues. Thank you!!!

Please post the complete output message you get when you try to install the package

install.packages("TTR")

This is when I try to install ("TTR") :

There is a binary version available but the source version is later:
binary source needs_compilation
TTR 0.24.2 0.24.3 TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

This is what pops up after I enter 'yes':
installing the source package ‘TTR’

trying URL 'https://cran.mirror.ac.za/src/contrib/TTR_0.24.3.tar.gz'
Content type 'application/octet-stream' length 317338 bytes (309 KB)

downloaded 309 KB

  • installing source package ‘TTR’ ...
    ** package ‘TTR’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
    ERROR: compilation failed for package ‘TTR’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library/TTR’
    Warning in install.packages :
    installation of package ‘TTR’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/0q/pl2zs3cj2_l6fl59mkfk1x3c0000gn/T/RtmpWXRgzV/downloaded_packages’

This is what it showed when I tried your link:
Warning in install.packages :
package ‘ https://cran.mirror.ac.za/src/contrib/TTR_0.24.3.tar.gz’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

The easiest solution would be to answer "no" to this question, you would get a precompiled binary version that is a little older but much easier to install.
If you need to install the latest version from source, then you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.
https://cran.r-project.org/bin/macosx/tools/

2 Likes

Whoa!! Really? It just worked. I really appreciate the help. Thanks a million!!! :smiley:

The link you just provided to install Xcode doesn't just seem to be working. It starts downloading.. goes the half way before it just comes to stop. Wondering if you could provide an alternate, please. Thank you!!

Sorry but I'm not a Mac user, that link is from the official CRAN documentation, I have no idea from where else you could get it.

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.