Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in install.packages : cannot remove prior installation of package ‘DBI’

Tags:

r

I attempted install.packages("RMySQL") and it runs for a second and then says:

Error in install.packages : cannot remove prior installation of package ‘DBI’

I did remove.packages("DBI") and it says:

remove.packages("DBI") Removing package from ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library’ (as ‘lib’ is unspecified)

Then I retry install.packages("RMySQL") and it says:

Error in install.packages : cannot remove prior installation of package ‘DBI’

The DBI dependency is not actually getting removed or something. Or possibly I removed it from the wrong area? I'm confused.

like image 226
SUCKYPROGRAMMER Avatar asked Aug 28 '17 15:08

SUCKYPROGRAMMER


People also ask

Do you want to restart R prior to installing?

Restarting R prior to updating these packages is strongly recommended. RStudio can restart R and then automatically continue the installation after restarting (all work and data will be preserved during the restart).

How do I uninstall a package in R?

If you need to do an uninstall package operation from within your code, you need to use the remove packages function at the command prompt. This command has the format of remove. packages(“name”) where “name” is the package name to be removed.


1 Answers

Try starting R without any startup files to prevent DBI from being loaded (however that happens on your box).

You should then be able to just delete the unattached package.

Alternatively, just remove the DBI/ directory from library directory.

It should look similar to this:

$ R --vanilla     ## prevent inits at load  R version 3.4.1 (2017-06-30) -- "Single Candle" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit)  R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details.    Natural language support but running in an English locale  R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications.  Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R.  > ls()               ## no variables character(0) > search()           ## no packages besides Base [1] ".GlobalEnv"        "package:stats"     "package:graphics"  [4] "package:grDevices" "package:utils"     "package:datasets"  [7] "package:methods"   "Autoloads"         "package:base"      >  
like image 101
Dirk Eddelbuettel Avatar answered Sep 22 '22 00:09

Dirk Eddelbuettel