Why I can load the packages I had detached?
1
1
Entering edit mode
2426986765 ▴ 10
@2426986765-22234
Last seen 5.0 years ago

source: remove.packages("AnnotationDbi") library("AnnotationDbi")

console: detach("package:AnnotationDbi", unload = TRUE) library("AnnotationDbi")

software error • 731 views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 3 months ago
United States

detach() detaches the package from the search() path; it does not remove the package from the library where it is installed.

Usually, removing a package is accomplished with remove.packages("AnnotationDbi"). One common reason for failure is if the package is installed in more than one library location.

pkgs <- installed.packages()
idx <- pkgs[, "Package"] %in% "AnnotationDbi"
sum(idx) # more than 1?
pkgs[idx,]

These might be removed with more than one call to remove.packages().

It might be that some of the library locations are not writeable by the user (e.g., an 'Administrator' installed the package). The administrator must then remove the package.

AnnotationDbi does not contain any compiled (C) source code, so the following is not an explanation for your specific question. It might be (on Windows) that the library was in use by another R session, or that in the current session a compiled 'dll' is in use in the current session that depends or imports AnnotationDbi. remove.packages() will then fail, silently, leaving a corrupt installation. All R sessions should be closed, and the corrupt package installation location directory removed 'by hand' through the operating system.

ADD COMMENT
0
Entering edit mode

Thank you, but how can I remove it from library?

ADD REPLY
0
Entering edit mode

I updated my answer. You should please update your question to copy and paste the commands that you use in your session, and the output of sessionInfo(). Here's mine...

> pkgs <- installed.packages()
> idx <- pkgs[, "Package"] %in% "AnnotationDbi"
> sum(idx) # more than 1?
[1] 1
> remove.packages("AnnotationDbi")
Removing package from '/Users/ma38727/Library/R/3.6/Bioc/3.10'
(as 'lib' is unspecified)
> remove.packages("AnnotationDbi")
Removing package from '/Users/ma38727/Library/R/3.6/Bioc/3.10'
(as 'lib' is unspecified)
Error in find.package(pkgs, lib) :
  there is no package called 'AnnotationDbi'
> library(AnnotationDbi)
Error in library(AnnotationDbi) :
  there is no package called 'AnnotationDbi'
> sessionInfo()
R version 3.6.1 Patched (2019-10-25 r77333)
Platform: x86_64-apple-darwin17.7.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS:   /Users/ma38727/bin/R-3-6-branch/lib/libRblas.dylib
LAPACK: /Users/ma38727/bin/R-3-6-branch/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1
ADD REPLY

Login before adding your answer.

Traffic: 703 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6