0

I am trying to install the forecast package in R via: install.packages('forecast'), nevertheless this is not working.

The result:

  There is a binary version available but the source version is later:
         binary source needs_compilation
forecast    8.2    8.3              TRUE

Do you want to install from sources the package which needs compilation?

Not sure what to answer here, 'yes' or 'no'. If I answer 'no', the result is:

trying URL 'https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/forecast_8.2.tgz'
Content type 'application/x-gzip' length 2204227 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

tar: Failed to set default locale

The downloaded binary packages are in
    /var/folders/qn/syx5z5tj4s5075wwmrrd3hbr0000gn/T//RtmpTBDqVs/downloaded_packages

If I type 'yes' some additional items are installed and I receive one error note:

Warning in install.packages :
  installation of package 'forecast' had non-zero exit status

Unfortunately I cannot proceed with the necessary functions that this package provides. Thanks for any suggestions.

Sean
  • 35
  • 8
  • Possible duplicate of https://stackoverflow.com/q/3907719/3358272 – r2evans May 15 '18 at 15:33
  • @r2evans Do not see the similarities though :( – Sean May 15 '18 at 15:46
  • 1
    Your "error" is a warning, likely caused or related to `tar: Failed to set default locale`. I don't know that this is *the* problem, but it's the only one I can identify in your question here. (The "warning" itself is not very informative.) Did you try it? (Again, I don't *know* that it'll work, but the other question is a mac with `tar: Failed...`, yours is a mac with `tar: Failed...`, so ... it's the best I have at the moment.) – r2evans May 15 '18 at 15:56
  • @r2evans Thanks for linking me. It's a weird error that does not directly make sense to me. – Sean May 15 '18 at 16:01
  • 1
    Sure, BUT ... anything that causes `tar` to hiccup will cause the installatino to fail. Perhaps there is something internationalized within the `forecast` package (idk) that is making `tar` second-guess itself. Go to the `RtmpTBDqVs/downloaded_package/` directory (in a terminal) and manually do `tar tzf forecast_8.2.tgz` to see if you can reproduce the error on the console. If it fails, then try `LANG=en_US.UTF-8 tar tzf forecast_8.2.tgz` and/or `force.LANG=...` and see if the behavior changes. – r2evans May 15 '18 at 16:05
  • @r2evans So what I did was the following. Install the latest version of R and RStudio. Use this line of code: 'system('defaults write org.R-project.R force.LANG en_US.UTF-8')', then restart the system. This seemed to work, but I've not yet tried everything I need to do. – Sean May 15 '18 at 16:26
  • Are you actually sure that if you choose "no" and install the binary package, it then fails to install? –  May 15 '18 at 16:27
  • @r2evans After those steps it does not ask me that question anymore. – Sean May 15 '18 at 16:45
  • Sounds like the problem is resolved. Is that right? – r2evans May 15 '18 at 17:10
  • @r2evans I agree – Sean May 15 '18 at 18:26

1 Answers1

0

I had the same problems, changing primary CRAN repository works for me Tools > Global Options > Packages