cannot install packages in RStudio on mac

I have a problem installing some packages and I know the problem is on my end.
I'm on a Mac, Ventura 13.3.1 OS, latest versions of R and RStudio.

Here is my code (quite simple):

remotes::install_github("stan-dev/cmdstanr")
devtools::install_github("rmcelreath/rethinking")

here is the error message:

Downloading GitHub repo stan-dev/cmdstanr@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────
:heavy_check_mark: checking for file ‘/private/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T/Rtmpe1DO8E/remotes97c752247d2/stan-dev-cmdstanr-7036eee/DESCRIPTION’ ...
─ preparing ‘cmdstanr’:
:heavy_check_mark: checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
Omitted ‘LazyData’ from DESCRIPTION
─ building ‘cmdstanr_0.5.3.tar.gz’

Error: 3:49: unexpected string constant
3: if (Sys.getenv("RSTUDIO") == "1" && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Warning: installation of package ‘/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T//Rtmpe1DO8E/file97c1d996812/cmdstanr_0.5.3.tar.gz’ had non-zero exit statusDownloading GitHub repo rmcelreath/rethinking@HEAD
Skipping 1 packages not available: cmdstanr
── R CMD build ──────────────────────────────────────────────────────────────────────────
:heavy_check_mark: checking for file ‘/private/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T/Rtmpe1DO8E/remotes97c17c66e2e/rmcelreath-rethinking-2f01a9c/DESCRIPTION’ ...
─ preparing ‘rethinking’:
:heavy_check_mark: checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ looking to see if a ‘data/datalist’ file should be added
─ building ‘rethinking_2.31.tar.gz’

Error: 3:49: unexpected string constant
3: if (Sys.getenv("RSTUDIO") == "1" && RSTUDIO_TERM")) &&
4: Sys.info()["
^
Execution halted
Warning: installation of package ‘/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T//Rtmpe1DO8E/file97c646b9a33/rethinking_2.31.tar.gz’ had non-zero exit status.

I uninstalled and reinstalled R this morning with same result. I tried installing on R (not RStudio) with same result.

Any ideas?

Many thanks.

Is it possible that this code is in your .Rprofile file?

It is entirely possible. But I'm just an epidemiologist, not a tech person, so the questions are:

  1. how would I access the file?
  2. how would I either move to the "right" file or edit it?
    Many thanks.

I figured out how to edit (I think) and found this in the editor:

if (Sys.getenv("RSTUDIO") == "1" && RSTUDIO_TERM")) &&
Sys.info()["sysname"] == "Darwin") {
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")
}

of course, the above code had several "issues", ie, unexpected string constants. Do I fix them and if so, how?

Many thanks again.

Okay, not ready to be a tech guy yet...I did these some edits (I assume incorrect ones) and got this message:

Error in Sys.getenv("RSTUDIO") == "1" && (("RSTUDIO_TERM")) : invalid 'y' type in 'x && y' Execution halted Warning: installation of package ‘/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T//RtmphqlBRm/filef8019245b57/cmdstanr_0.5.3.tar.gz’ had non-zero exit statusDownloading GitHub repo rmcelreath/rethinking@HEAD Skipping 1 packages not available: cmdstanr

You can see that I added some parentheses and a quotation mark in front of RSTUDIO_TERM. Thoughts?

Thanks again.

Aaaaarrrggghhh!!
I tried another variation, also rejected with the error message:

Error in "1" && "RSTUDIO_TERM" : invalid 'x' type in 'x && y' Execution halted Warning: installation of package ‘/var/folders/66/6yy31gvd2ggdrcmn0v72j0z40000gn/T//RtmpRNhaSs/file106a366d852a/rethinking_2.31.tar.gz’ had non-zero exit status.

I used this code in Rprofile:

if (Sys.getenv("RSTUDIO") == (("1" && "RSTUDIO_TERM")) &&
Sys.info()["sysname"] == "Darwin") {
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")
}

Maybe this code shouldn't be here at all? Please advise!!

Many thanks.

Victory!! I deleted that code entirely from Rprofile and everything worked! Amazing! Thanks for your idea which lead to the solution!!

1 Like

This topic was automatically closed 42 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.