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.
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.