0

Solution

Delete the .RDS in the Artifactory cache.


Problem

I have a very weird issue with using R 3.6.2 on Ubuntu and a corporate mirror of CRAN. Let's say I run the following command:

install.packages('rlang')

What I get back is that the version 0.4.2 could not be found. When I look into the repository manually I find that 0.4.2 indeed does not exist, but 0.4.3 does. First I thought that something is wrong with the PACKAGES file where the repository stores the index. But I looked into it and it points to the correct and available version of rlang.

From where does R gets the version number it puts into the query URL when install.packages() is executed?

Updates

I tried install.packages("http://private.com/src/contrib/rlang_0.4.3.tar.gz", repos=NULL) and it works. Next I will try to replicate the issue in new Ubuntu environment. Maybe I messed up while installing R and upgrading it to 3.6.2


When I downgrade to R version 3.4.4 the issue persists. Maybe it has something to do with the corporate mirror? I will try an official one.


Thanks to Dirks answer I found out with available.packages() that something is wrong with the mirror and not the R installation.

> AP <- available.packages()
> res <- AP[ AP[,1] == "rlang", ]
> str(res)
 Named chr [1:17] "rlang" "0.4.2" NA "R (>= 3.2.0)" NA NA ...
 - attr(*, "names")= chr [1:17] "Package" "Version" "Priority" "Depends" ...

Since the readable version of PACKAGES in the mirror contains 0.4.3 I assume that the PACKAGES.rds is at fault. Next I will try to read in that object to confirm my presumption.


Dirk recommended me to check the timestamps of the indices and I think I found the issue. 0.4.3 was released a short time ago. While the readable index was updated just few others ago, the .rds file (probably used by R) has not been updated since 2020-01-16. And so R tries to download a version that is not part of the repository anymore.

Now I wonder who is in charge of updating the RDS file? The repository itself? I'll report back in the next time... Maybe the problem resolves itself after a random batch job updates the repository.

The rlang package: Rlang package

The timestamps: Different timestamps

The PACKAGES content: PACKAGES content


I manually downloaded PACKAGES.rds and used readRDS() on it. It points to the old version. I also checked the repo that is mirrored. Its PACKAGES.rds points to the correct version. In addition I made sure that the issue persists independent from the distribution and image I'm using.

trallnag
  • 2,041
  • 1
  • 17
  • 33

2 Answers2

3

You can ask R that very question! The available.packages() function tells you "everything" it knows, and one entry is 'Repository'.

So:

R> AP <- available.packages()       ## all known packages given options("repos")
R> res <- AP[ AP[,1] == "rlang", ]  ## find rlang
R>
R> str(res)
 Named chr [1:17] "rlang" "0.4.3" NA "R (>= 3.2.0)" NA NA ...
 - attr(*, "names")= chr [1:17] "Package" "Version" "Priority" "Depends" ...
R> 
R> names(res)
 [1] "Package"               "Version"              
 [3] "Priority"              "Depends"              
 [5] "Imports"               "LinkingTo"            
 [7] "Suggests"              "Enhances"             
 [9] "License"               "License_is_FOSS"      
[11] "License_restricts_use" "OS_type"              
[13] "Archs"                 "MD5sum"               
[15] "NeedsCompilation"      "File"                 
[17] "Repository"           
R> 
R> res["Repository"]
                               Repository 
"https://cloud.r-project.org/src/contrib" 
R> 

No surprise here as that is the default repository for per the default configuration I use (and encode in the Debian / Ubuntu package).

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Interesting, thanks a lot. It gives me the version 0.4.2 back. Meaning that the problem lies within the corporate mirror... There are several PACKAGES files in the repository, but with different file endings. One of them is .RDS, a R-object but serialized. Maybe the object wasn't updated (because the readable PACKAGES file definitely points to 4.3.3). I will update my post – trallnag Jan 26 '20 at 17:27
  • 1
    You could look at the timestamp of those top-level index files. – Dirk Eddelbuettel Jan 26 '20 at 17:30
  • That's it (I hope)! `0.4.3` was released `2020-01-25` according to https://github.com/r-lib/rlang/releases. The `PACKAGES` and `PACKAGES.gz` were updated today just few hours ago. But the `PACKAGES.rds` used by R has the timestamp `2020-01-16`. Awesome – trallnag Jan 26 '20 at 17:36
1

if you do

?install.packages()

it will give you some information on the function that does the retrieval, there is a "repo" argument you can input. Most of the time if I have package install issues and are not TOO worried about exact versions running a:

install.packages("rlang", dependencies = TRUE)

usually does well for me

Daniel_j_iii
  • 3,041
  • 2
  • 11
  • 27
  • I tried it with `dependencies=TRUE`, but still the same problem. R looks for the wrong version. Weirdly, `install.packages("http://private.com/src/contrib/rlang_0.4.3.tar.gz", repos=NULL)` works. – trallnag Jan 26 '20 at 16:05