r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
646 stars 57 forks source link

pak::lockfile_create() fails when using depends for package using any other syntax than ({package_name}>=version) #503

Closed thomasyu888 closed 1 year ago

thomasyu888 commented 1 year ago

Here is the respository: https://github.com/Sage-Bionetworks/synapser/tree/update-client-version. I discovered this issue when trying to use r-lib/actions/setup-r-dependencies@v2

> pak::lockfile_create()
✖ Creating lockfile pkg.lock [423ms]                                        
Error: 
! error in pak subprocess
Caused by error: 
! Could not solve package dependencies:
* deps::.: Can't install dependency reticulate (== 1.28)
> pak::lockfile_create()
✔ Updated metadata database: 5.29 MB in 12 files.                         
✔ Updating metadata database ... done                                     
✖ Creating lockfile pkg.lock [14.4s]                                       
Error: 
! error in pak subprocess
Caused by error: 
! Could not solve package dependencies:
* deps::.: Can't install dependency reticulate (<= 1.28)
gaborcsardi commented 1 year ago

This is not a bug in pak, but it is just how CRAN metadata is organized: it does not contain older versions of reticuate, only the latest 1.29 version. R packages do not properly support versioned dependencies.

If you need to depend on a specific older version, you can use the Remotes field and the pkg@version syntax, see https://pak.r-lib.org/reference/pak_package_sources.html#the-remotes-field

thomasyu888 commented 1 year ago

Thanks @gaborcsardi for the explanation! Your solution worked perfectly! Closing this.