Lazarus Thurston
Lazarus Thurston

Reputation: 1287

package DBI installed twice but cannot uninstall from one libpath

So in other words, I have the package DBI installed twice, in two library paths (.libpaths()[1] and .libpaths()[3]). I use the Rstudio server on Ubuntu 22.

Am trying to remove the older version from .libpaths()[3] but am unsuccessful.

Tried the following:

  1. Restarted R so the package is not loaded in the current session.
  2. Ran the command: remove.packages("DBI",lib = .libPaths()[3]).

Repeat the above steps many times. Refreshed the package window of rstudio, and also checked using find.package("DBI",lib.loc = .libPaths()[3])

But the package still is installed in both libpaths.

See Rstudio screeshot.

enter image description here

My Rstudio version:

RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for Ubuntu Bionic Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36

My Ubuntu version:

$ lsb_release -a 
No LSB modules are available. 
Distributor ID: Ubuntu Description:    Ubuntu 20.04.4 
LTS Release:        20.04 
Codename:       focal

Upvotes: 1

Views: 60

Answers (1)

wibeasley
wibeasley

Reputation: 5297

If removing the package through R's remove.packages() doesn't work, you can delete the package through the file system. As you wrote, .libPaths() discloses the location of each "library" (ie, a big directory that contain packages.

Each package is a subdirectory in the library. Delete the package's directory to remove/uninstall the package. It's best if no OS process is using the files within the package's directory, so close all instances of R & RStudio.

As you wrote, a package may be in multiple libraries (which is discouraged because it can cause subtle problems). So look in each library

The library & directory structure is described in detail the 2nd edition of R Packages: https://r-pkgs.org/Structure.html#sec-library.

The SO post overlaps with Complete remove and reinstall R, including all packages.

Upvotes: 0

Related Questions