Reputation: 2376
Delete the .RDS
in the Artifactory cache.
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?
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.
Upvotes: 0
Views: 539
Reputation: 368231
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).
Upvotes: 3
Reputation: 3242
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
Upvotes: 1