r-lib / pkgbuild

Find tools needed to build R packages
https://pkgbuild.r-lib.org
Other
65 stars 33 forks source link

cannot install binary package built on same system, "is not available for this version of R" #134

Closed josherrickson closed 2 years ago

josherrickson commented 2 years ago

I'm using build(binary = TRUE) to try and build a binary version of my package. However, the package then immediately fails to install on the same system:

> build(binary = TRUE)
─  installing to library ‘/private/var/folders/q_/4vzm_nzd33j9nr4qk1ds2ct00000gn/T/RtmpybZEcX/temp_libpath2b5828068c04’
─  installing *source* package ‘mypackage’ ...
   ** using staged installation
   ** libs
   make: Nothing to be done for `all'.
   installing to /private/var/folders/q_/4vzm_nzd33j9nr4qk1ds2ct00000gn/T/RtmpybZEcX/temp_libpath2b5828068c04/00LOCK-mypackage/00new/mypackage/libs
   ** R
   ** data
   *** moving datasets to lazyload DB
   ** byte-compile and prepare package for lazy loading
   ** help
   *** installing help indices
   ** building package indices
   ** testing if installed package can be loaded from temporary location
   ** checking absolute paths in shared objects and dynamic libraries
   ** testing if installed package can be loaded from final location
   ** testing if installed package keeps a record of temporary installation path
─  creating tarball
   packaged installation of ‘mypackage’ as ‘mypackage_0.1.0.tgz’
─  DONE (mypackage)
[1] "/Users/josh/repositories/R/mypackage_0.1.0.tgz"
> install.packages("/Users/josh/repositories/R/mypackage_0.1.0.tgz")
Installing package into ‘/opt/homebrew/lib/R/4.1/site-library’
(as ‘lib’ is unspecified)
Warning message:
package ‘/Users/josh/repositories/R/rrelaxiv_0.1.0.tgz’ 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

I'm not sure how to proceed or how to even debug this.

Using R 4.1.2 installed via homebrew on Mac 12.2.1.

gaborcsardi commented 2 years ago

This has not much to do with pkgbuild. When installing from a file, you need to add repos to install.packages():

install.packages(..., repos = NULL)

Otherwise it will interpret the path as a package name, as the warning tells you:

package ‘/Users/josh/repositories/R/rrelaxiv_0.1.0.tgz’ is not available for this version of R