[Rd] Trouble installing packages when history mechanism is modified by user profile

Henrik Bengtsson henrik.bengtsson at gmail.com
Fri Mar 3 18:55:59 CET 2017


Using

if (interactive()) utils::loadhistory(file = "~/.Rhistory")

should solve your problem.  The reason is that install.packages() in
turn launches a non-interactive child R process that installs the
package.  When that process loads your startup file, it fails, because
that function can only be used in interactive mode.  Here's an
example:

$ Rscript -e "utils::loadhistory()"
Error in .External2(C_loadhistory, file) : no history mechanism available

/Henrik

On Fri, Mar 3, 2017 at 5:51 AM, Hugo Raguet <hugo.raguet at gmail.com> wrote:
> I tried installing the 'ks' package from my interactive R session, it
> failed with the following
>
> Erreur dans .External2(C_loadhistory, file) :
>   aucun mécanisme d'historique des commandes disponible
> Calls: <Anonymous>
> Exécution arrêtée
>
> second line is french for "no command history mechanism available", fouth
> is "execution stopped".
> This does not happen when I comment out the following line from my
> .Rprofile:
> utils::loadhistory(file = "~/.Rhistory")
>
> On Stack Overflow, someone else has similar trouble with another package,
> which seems to be also related to command history:
> http://stackoverflow.com/questions/18240863/installing-packages-on-r-fails-when-loading-rprofile#18256224
>
> Is this a bug in R, or in the concerned packages?
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list