pak icon indicating copy to clipboard operation
pak copied to clipboard

Not installing specific version available on CRAN

Open fh-mthomson opened this issue 2 years ago • 10 comments

Related to #582, but specific to {package}@{version} not installing as expected, even after running pak::meta_update():

Reprex:

options(repos = "https://packagemanager.posit.co/cran/__linux__/jammy/latest")

# baseline
pak::meta_update()
#> 
#> ✔ Updated metadata database: 3.16 MB in 2 files.
#> 
#> ℹ Updating metadata database
#> ✔ Updating metadata database ... done
#> 
packageVersion('paws')
#> [1] '0.5.0'

pak::pak("[email protected]")
#> 
#> ✔ All system requirements are already installed.
#> 
#> ℹ No downloads are needed
#> ✔ 1 pkg + 28 deps: kept 29 [3.1s]
packageVersion('paws') # wrong
#> [1] '0.5.0'

devtools::install_version('paws', "0.4.0")
#> Downloading package from url: https://packagemanager.posit.co/cran/__linux__/jammy/latest/src/contrib/Archive/paws/paws_0.4.0.tar.gz
#> Installing package into '/home/michael.thomson/R/x86_64-pc-linux-gnu-library/4.1'
#> (as 'lib' is unspecified)
packageVersion('paws') # correct
#> [1] '0.4.0'

Created on 2024-01-16 with reprex v2.0.2

fh-mthomson avatar Jan 16 '24 23:01 fh-mthomson

You can try

> pak::pak("cran/[email protected]")
                                                                            
✔ All system requirements are already installed.
  
ℹ No downloads are needed
✔ 1 pkg + 28 deps: kept 27 [2.2s]
> packageVersion('paws') 
[1] ‘0.4.0’

emaigne avatar Mar 13 '24 13:03 emaigne

Sure, but, I think that's a workaround, not the expectation, in that you should be able to install via {package}@{version} without specifying it's from CRAN?

fh-mthomson avatar Mar 13 '24 15:03 fh-mthomson

Agreed !

emaigne avatar Mar 13 '24 15:03 emaigne

Also replicated with a different package:

> pak::pak("[email protected]")
                                                                           
  
ℹ No downloads are needed
✔ 1 pkg: kept 1 [3s]

Restarting R session...

> packageVersion('withr')
[1] ‘3.0.0’

fh-mthomson avatar Apr 11 '24 04:04 fh-mthomson

This seems to work now, but please reopen if you still have problems. Thanks!

> pak::pak("[email protected]")
→ Will update 1 package.
→ Will download 1 package with unknown size.
+ withr 3.0.2 → 2.5.2 [bld][dl]

? Do you want to continue (Y/n)
ℹ Getting 1 pkg with unknown size
✔ Got withr 2.5.2 (source) (102.32 kB)
✔ Downloaded 1 package (102.32 kB) in 2.6s
ℹ Building withr 2.5.2
✔ Built withr 2.5.2 (10.6s)
✔ Installed withr 2.5.2  (1.2s)
✔ 1 pkg: upd 1, dld 1 (102.32 kB) [30.6s]

gaborcsardi avatar May 09 '25 11:05 gaborcsardi

Unfortunately not fully, even after upgrading to 0.9.0:

packageVersion('withr')
#> [1] '3.0.2'
pak::pak("[email protected]")
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
#> 
#> 
#> ℹ No downloads are needed
#> ✔ 1 pkg: kept 1 [6.7s]
packageVersion('withr')
#> [1] '3.0.2'

Created on 2025-06-02 with reprex v2.1.1

In contrast, using the vctrs example in https://github.com/r-lib/pak/issues/724, it does work:

packageVersion('vctrs')
#> [1] '0.6.5'
pak::pak("[email protected]")
#> ℹ Loading metadata database
#> ✔ Loading metadata database ... done
#> 
#> 
#> → Will update 1 package.
#> → The package (0 B) is cached.
#> + vctrs 0.6.5 → 0.6.4 [cmp]
#> 
#> ℹ No downloads are needed, 1 pkg is cached
#> ✔ Got vctrs 0.6.4 (x86_64-pc-linux-gnu) (1.28 MB)
#> ✔ Installed vctrs 0.6.4  (1.5s)
#> ✔ 1 pkg + 4 deps: kept 1, upd 1, dld 1 (1.28 MB) [9.6s]
packageVersion('vctrs')
#> [1] '0.6.4'

Created on 2025-06-02 with reprex v2.1.1

Any debugging information I can provide to help narrow it down?

PS I don't have perms to Reopen Issue on GitHub, but hoping this comment is sufficient :)

fh-mthomson avatar Jun 02 '25 22:06 fh-mthomson

Also reproduced after:

  1. Clearing the cache: rm -rf ~/.cache/R/pkgcache
  2. Removing withr: remove.packages("withr", lib="~/R/x86_64-pc-linux-gnu-library/4.1")
> pak::pak("[email protected]")
✔ Updated metadata database: 2.59 MB in 9 files.                          
✔ Updating metadata database ... done                                     
                                                                           
→ Will install 1 package.
→ Will download 1 CRAN package (103.24 kB).
+ withr   3.0.2 [bld][dl] (103.24 kB)
  
ℹ Getting 1 pkg (103.24 kB)
✔ Got withr 3.0.2 (source) (217.40 kB)                                
✔ Downloaded 1 package (217.40 kB) in 509ms                           
ℹ Building withr 3.0.2
✔ Built withr 3.0.2 (713ms)                                  
✔ Installed withr 3.0.2  (1.2s)                                
✔ 1 dep: added 1, dld 1 (217.40 kB) [20.3s] 

fh-mthomson avatar Jun 02 '25 22:06 fh-mthomson

The documentation still states that version tags for standard:: sources are only parsed, but not used. Would be great if it could be supported.

kkmann avatar Sep 29 '25 15:09 kkmann