简体   繁体   中英

package cannot be unloaded in R: cannot install package

I am trying to install a package in R, but cannot get around the following error.

What is going on? :(

I am running Fedora 20, R 3.2

 biocLite("monocle")
    BioC_mirror: http://bioconductor.org
    Using Bioconductor version 3.0 (BiocInstaller 1.16.5), R version 3.2.0.
    Installing package(s) 'monocle'
    trying URL 'http://bioconductor.org/packages/3.0/bioc/src/contrib/monocle_1.0.0.tar.gz'
    Content type 'application/x-gzip' length 332309 bytes (324 KB)

    downloaded 324 KB

    installing *source* package ‘monocle’ ...
    R
    inst
    preparing package for lazy loading
    Error in unloadNamespace(package) : 

    namespace ‘plyr’ is imported by ‘reshape2’, ‘ggplot2’, ‘scales’ so cannot be unloaded
    Error in library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : 

    Package ‘plyr’ version 1.8.1 cannot be unloaded
    ERROR: lazy loading failed for package ‘monocle’
    removing ‘/home/user/R/x86_64-redhat-linux-gnu-library/3.2/monocle’

我通过重新启动 R 解决了这个问题。

looks like monocle is trying to unload and install plyr again but it cant because other packages namely ggplot2 , scales and reshape2 has dependency on plyr . Please remove these packages using

remove.packages("ggplot2")
remove.packages("reshape2")
remove.packages("scales")

and finally

remove.packages("plyr")

try installing monocle again now.

Monocle does depends on plyr

Depends R (>= 2.7.0), HSMMSingleCell(>= 0.101.5), Biobase, ggplot2 (>= 0.9.3.1), splines, VGAM (>= 0.9-5), igraph (>= 0.7.0), plyr

on monocle homepagehttp://bioconductor.org/packages/release/bioc/html/monocle.html

I was getting the same error for MASS package.

Below command used to remove that package.

remove.packages("MASS")

Tried freshly below commands and it worked.

install.packages("MASS")
library(MASS)

卸载软件包后,退出()并再次重新启动 R

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM