I'm trying to install a package I developed for local use (not for submission to CRAN). Initially, I tried installing it using install.packages(), but this did not work as for some reason, my dependencies listed in Imports in the DESCRIPTION file were not installed.
SO i then tried installing my package using remotes::install_local(path_to_package, dependencies=TRUE) . When testing to see if this worked I removed one of the package dependencies from my R studio manually ("tibble", namely) before running the latter command. However, I then get this error which halts execution of my package download
Error: (converted from warning) package 'tibble' was built under R version 3.6.3
Execution halted
Hi and welcome to RStudio Community. It sounds like you may be new to R package development and if so, there is a wonderful free online book all about developing packages that I highly recommend: https://r-pkgs.org.
As you already discovered, install.packages() only works for packages that are hosted by CRAN. It's hard to say exactly where the error you reference came from, but depending on how you "manually" removed the tibble dependency, you may be running into issues. You may want to check out the dependencies chapter of the R Packages book:
Error: (converted from warning) package 'tibble' was built under R version 3.6.3
Execution halted
ERROR: lazy loading failed for package 'Package_Name'
* removing 'pathtopackage_Package_Name'
Error: Failed to install 'Package_Name' from local:
(converted from warning) installation of package
Got it! Can you post the entire console output from when you tried remotes::install_local(path_to_package, dependencies=TRUE? It looks to me like there may be some other package installation error and the message you're getting about tibble is just a side-effect.
Also, if you install tibble first, are you able to install your package using install_local()?
I just checked, even if I install tibble first I get the same error. Here is the console output. Thanks.
remotes::install_local(path_to_package, dependencies=TRUE)
β checking for file 'path_to_package/DESCRIPTION' (543ms)
- preparing 'Package_Name': (1.4s)
β checking DESCRIPTION meta-information ...
β checking vignette 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 'Package_Name_0.1.0.tar.gz'
Installing package into βC:/Users/Documents/R/win-library/3.6β
(as βlibβ is unspecified)
* installing *source* package 'Package_Name' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error: (converted from warning) package 'tibble' was built under R version 3.6.3
Execution halted
ERROR: lazy loading failed for package 'MSP'
* removing 'path_to_package'
Error: Failed to install 'Package_Name' from local:
(converted from warning) installation of package βC:/Users/AppData/Local/Temp/RtmpEHOZ4M/file2d6444a54395/Package_Name_0.1.0.tar.gzβ had non-zero exit status
You can definitely try @andresrcs's suggestion, but since you get the same error even when tibble is installed, I think it may be something else. What is the 'MSP' package? Also, if you run devtools::check() on your package do you get and errors, warnings, or notes?
I ran devtools::check() and noticed a note I previously overlooked alerting me to the fact that I had an overlap of packages listed in Imports and Suggests. Once I ammended this everything seems to work! Well it works if I use the remotes::install_packages(), but not if I choose Install Packages from the tools tab. I presume this is because it is executing the install.packages() command when I do this, which is incompatible with local packages?
Glad you got it working! Another option to install a local package is to use devtools::install() while you are in the package directory. And yes, the Install Packages button uses install.packages() so it only works for CRAN packages.