Error in rbind(info, getNamespaceInfo(env, "SomePackage")) - GNU R

Here are few tips on how to troubleshoot the package installation or library loading error in GNU R. Here is the error message I was greeting when trying to load SemiPar package however this guide should work for any other GNU R cran pakages:

> library(SemiPar)
Error: package or namespace load failed for ‘SemiPar’ in rbind(info, getNamespaceInfo(env, "S3methods")):
 number of columns of matrices must match (see arg 2)

The above message does not tell much. You can always try to run traceback() R function to see if it gives you more details about the previous error.

Errors of this type are most likely to be linked with package version inconsistencies. Say package A is installed but it does not work or produces an error because package B is of higher or lower version than package A. This could be caused by installation of CRAN packages from different sources. For example some packages might be installed as part of your standard distro repository and some were installed directly from CRAN repository and recompiled.

Next, step is to try install/reinstall the package in question like in this case the SemiPar package by executing the:

> install.packages("SemiPar")

However, the above command also results in error:

* installing *source* package ‘SemiPar’ ...
** package ‘SemiPar’ successfully unpacked and MD5 sums checked
** R
** data
** byte-compile and prepare package for lazy loading
Error in rbind(info, getNamespaceInfo(env, "S3methods")) : 
  number of columns of matrices must match (see arg 2)
ERROR: lazy loading failed for package ‘SemiPar’
* removing ‘/home/lubos/R/x86_64-pc-linux-gnu-library/3.5/SemiPar’
Warning in install.packages :
  installation of package ‘SemiPar’ had non-zero exit status

If this is the case the next step is to make sure the all dependencies are met. To do so simply head over the CRAN package repository website using the following URL:

Which in this case the aboe URL translates to Once on the page check for all Depends on Imports requirements for that package. Example:

For our package there are 3 Imports packages required namely they are MASS, cluster, nlme. The next step is to make sure that those package are installed or that they satisfy a version number required by our SemiPar package. To do so use install.packages("PackageName") for all required packages.

In case you are unable to install/reinstall the dependent packages head over to CRAN and confirm that you have all Depends on Imports requirements for that package as well and so on.

Yes, this is pain. Hence, if possible you should always install packages from your Linux distro standard repository as they are tested and will pull all dependencies automatically.

When you have installed all your Depends on Imports requirements for the main package simply attempt to install the main package again. This time it should work with no problems:

> install.packages("SemiPar")

After that you should also be able to test the installation and the actual library by:

> library(SemiPar)

All done. I hope this guide helps someone to save headache.