Closed billdenney closed 2 years ago
Have you checked whether this is a general issue that's not specific to pkgr? That pkgr configuration has
Repos:
- CRAN: "https://cran.microsoft.com/snapshot/2022-05-14"
- cmdstanrrepo: "https://mc-stan.org/r-packages/"
Do you see the same failure if you try to install cmdstanr from the same repos in another way? For example:
# in some scratch directory
$ Rscript -e 'renv::init()'
$ Rscript -e 'renv::install("cmdstanr", repos = c("https://cran.microsoft.com/snapshot/2022-05-14", "https://mc-stan.org/r-packages/"))'
I just checked, and this works:
install.packages("cmdstanr", repos = c("https://cran.microsoft.com/snapshot/2022-05-14", "https://mc-stan.org/r-packages/"))
Looking again at your pkgr config, why does it specify the cmdstanr should be installed from source?
Customizations:
Packages:
- cmdstanr:
Type: source
I have very little Windows knowledge, but, to build from source, I think you'd need to be in an Rtools bash shell with the appropriate dependencies installed. (The particular failure you're seeing is related to cp
.)
@kyleam , In prior iterations, cmdstanr had to be installed from source. They appear to have binaries now. I do have Rtools, and this worked successfully in the past.
Perhaps we could consider this a different issue, then. Might it be possible to detect if compilation is required and if so, do some test in Windows to test if Rtools is installed and compatible with the current version of R? Maybe a simpler method would be: If installing a package from source in Windows and there is an error suggest that and Rtools bash shell may be required?
On a Windows VM I have access to I've confirmed that I see a similar failure (Try '/usr/bin/cp --help' for more information
) when using pkgr to install cmdstanr 0.5.2 in the following context:
I see the same failure if I use install.packages
to install from source, so I have no reason to think this is directly related to pkgr:
> install.packages("cmdstanr", repos = c("https://cran.microsoft.com/snapshot/2022-05-14", "https://mc-stan.org/r-packages/"), type = "source", lib = "lib")
trying URL 'https://mc-stan.org/r-packages/src/contrib/cmdstanr_0.5.2.tar.gz'
Content type 'application/gzip' length 1104566 bytes (1.1 MB)
downloaded 1.1 MB
Warning in strptime(xx, f, tz = tz) :
unable to identify current timezone 'C':
please set environment variable 'TZ'
* installing *binary* package 'cmdstanr' ...
cp: unknown option -- )
Try '/usr/bin/cp --help' for more information.
ERROR: installing binary package failed
* removing 'C:/Users/Administrator/scratch/pkgr-iss-403/lib/cmdstanr'
The downloaded source packages are in
‘C:\Users\Administrator\AppData\Local\Temp\2\RtmpAV1Wgz\downloaded_packages’
Warning message:
In utils::install.packages("cmdstanr", repos = c("https://cran.microsoft.com/snapshot/2022-05-14", :
installation of package ‘cmdstanr’ had non-zero exit status
I think the root problem is that https://mc-stan.org/r-packages/ has a binary package at src/contrib/cmdstanr_0.5.2.tar.gz.
Perhaps we could consider this a different issue, then. Might it be possible to detect if compilation is required and if so, do some test in Windows to test if Rtools is installed and compatible with the current version of R?
As you mention next, I think such probing is complicated. In my view that's well outside pkgr's scope, even if we could do a fairly accurate job at diagnosing the problem (which I'm not convinced we could).
Maybe a simpler method would be: If installing a package from source in Windows and there is an error suggest that and Rtools bash shell may be required?
Thanks for the suggestion. My opinion is that pkgr should stick to relaying the underlying failure, without adding on its own guesses about what could be going wrong. Perhaps others will weigh in with their thoughts, though.
I agree with @kyleam here. I like your thinking @billdenney but I think we should be careful about trying to diagnose these kind of failures and automatically giving advice on how to fix them. Feels like it might cause more problems than it would fix...
It seems like the problem here is on the cmdstanr
side, and @kyleam has filed an issue with them already (here if you missed it, thanks Kyle!)
As for fixing your specific problem @billdenney , I assume this works because it's installing from the binary, right?
install.packages("cmdstanr", repos = c("https://cran.microsoft.com/snapshot/2022-05-14", "https://mc-stan.org/r-packages/"))
Have you tried getting rid of the source Customization in your pkgr.yml
and installing from that? I'm not aware of the previous issue with cmdstanr
and binary, but I know the package is fairly young, so maybe it's a thing of the past by now?
Thanks for the research into the issue. It makes sense not to go too far in diagnosing the issue unless you have full control over it. So, all of your thoughts make sense.
I believe that cmdstanr only intended to ship source packages. So, I think that the issue @kyleam raised over there is real. Regardless, I will close this as it seems to be a very rational "wontfix" issue.
When trying to update everything on my system, I got the following error from trying to install
cmdstanr
. My pkgr.yml (renamed to .txt) file is here: pkgr.txtI'm running Windows 10 with R 4.1.2.