Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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’
like image 766
gaelgarcia Avatar asked Sep 24 '15 21:09

gaelgarcia


2 Answers

I resolved this by restarting R.

like image 170
zach Avatar answered Sep 17 '22 01:09

zach


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 homepage http://bioconductor.org/packages/release/bioc/html/monocle.html

like image 39
Dhawal Kapil Avatar answered Sep 20 '22 01:09

Dhawal Kapil