Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
735 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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"     
> 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...