Error installing R package from local file: hard-coded installation path.

I am developing an R package, which during development, I am distributing among colleagues with tarballs. Some of them are unable to install the package because of such an error:

> install.packages("~/Desktop/package.tar.gz", repos = NULL, type = "source")
* installing *source* package ‘package’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
No man pages found in package  ‘package’ 
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
ERROR: hard-coded installation path: please report to the package maintainer and use ‘--no-staged-install’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/package’
Warning in install.packages :
  installation of package ‘/Users/name/Desktop/package.tar.gz’ had non-zero exit status

The error tells us, that installation fails because of the hard-coded installation path. The thing is that I don't have installation path coded anywhere in the package (I use system.path() couple of times).
I am able to do the installation by running the command R CMD INSTALL package.tar.gz --no-staged-install all but this is not the desired installation method.

It is possible R CMD check is giving you a false positive, but we unfortunately can't know for sure unless you can provide the source to your package somewhere we can look at it, e.g. on GitHub or similar hosting services.

1 Like

I saw someone ask about the same error message with a package available on github ( I'm guessing this path check is new in 3.6? Do you know of any way of finding where in the package this path might be? Or get the check to print out the bad path so it's easier to find?

1 Like

For more context, the original question came from SO: I saw this article which mentioned the sicheck tool which I think I found here ( That tool seems to require that the package be successfully installed? So I went and seemed to be able to build the package with 3.5.1. (I didn't seem to be able to use --no-staged-install with 3.6 successfully). But running sicheck didn't return any bad paths.

1 Like

As the package I am developing is part of my work, I have to find out whether I can share the code.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.