Here is a tip. It is always a good idea to keep your packages updated. I learned it the hard way.

I was required to setup a new R Server installation for a client and install our custom written time series analysis and forecasting package onto this brand new shiny server. We configured a SQL 2016 instance with the latest R Server (in-database) engine. All I had to do is to install devtools and I can install the package from the git repository.

So, I installed devtools with install.packages("devtools"). I got some warnings concerning curl and XML packages but they did not seem important (it is always important!). I proceeded to installing the package from GitLab using SSH

library(devtools)
install_git(url = [email protected]:analyseR.DEV/analyser.git", credentiald = cred)

However, I kept getting the following error.

Error in 'git2r_clone': error authenticating: failed connecting agent

This was rather odd. This was a brand new installation and I have done this countless times. I have never seen an error like this before. As any sane person would do, I starting googling. After hours and hours of surfing from one blog to another, nothing worked. I thought maybe my credentials were wrong. I removed SSH keys and re-created a brand new couple. It did not work. Weird!

Then, I remembered sessionInfo() is a good friend because it would tell me loaded package versions. And, there is was. Old packages. Everything was out of date. When I ran update.packages(), it said everything was up-to-date. However, I knew forecast package was at version 8.2 at the time and the installed version was 6.1.

And then, it hit me. Every time I install/update a package, they are retrieved from Microsoft and not from CRAN. So, devtools was at the latest version with respect to Microsoft repositories but not CRAN. Running

update.packages(repos = "https://cloud.r-project.org/")

forced R to install the latest version of each package from CRAN. Then, I was able to install the necessary packages with no warnings or errors. Day saved!

TL;DR

  • Always update the packages of a new installation. Always!
  • Make use of sessionInfo() to check your environment.
  • Be aware of the source repository of the packages you are installing.