This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in installing Seurat

Hi everyone,

I have trouble installing Seurat in RStudio. The warning is as below. Can anyone help me?

Joshua

>install.packages("Seurat")

Installing package into ‘C:/Users/jongshin.kim/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/Seurat_3.1.1.zip' Content type 'application/zip' length 2166182 bytes (2.1 MB) downloaded 2.1 MBenter code here

> library(Seurat)

Registered S3 method overwritten by 'R.oo': method from
throw.default R.methodsS3 Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘htmlwidgets’

seurat

1 answer

Hey, please try these commands:

if (!requireNamespace('BiocManager', quietly = TRUE))
    install.packages('BiocManager')
BiocManager::install('htmlwidgets')

If that is successful:

install.packages("Seurat")

Hi Kevin,

Thank you for your advice. I tried the commands, but there is still a warning message as below - "there is no package called 'htmlwidgets'". Do you have any advice?

> install.packages("Seurat")

Installing package into ‘C:/Users/jongshin.kim/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/Seurat_3.1.1.zip' Content type 'application/zip' length 2166182 bytes (2.1 MB) downloaded 2.1 MB

package ‘Seurat’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\jongshin.kim\AppData\Local\Temp\RtmpmaqU4R\downloaded_packages

> library(Seurat)

Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘htmlwidgets’

What is the output of:

if (!requireNamespace('BiocManager', quietly = TRUE))
    install.packages('BiocManager')
BiocManager::install('htmlwidgets')

The output of the commands is as below. Thanks.

Joshua

Bioconductor version 3.9 (BiocManager 1.30.7), R 3.6.1 (2019-07-05) Installing package(s) 'htmlwidgets'

There is a binary version available but the source version is later: binary source needs_compilation htmlwidgets 1.5 1.5.1 FALSE

installing the source package ‘htmlwidgets’

trying URL 'https://cran.rstudio.com/src/contrib/htmlwidgets_1.5.1.tar.gz' Content type 'application/x-gzip' length 867206 bytes (846 KB) downloaded 846 KB

ERROR: failed to lock directory 'C:/Users/jongshin.kim/Documents/R/win-library/3.6' for modifying Try removing 'C:/Users/jongshin.kim/Documents/R/win-library/3.6/00LOCK-htmlwidgets'

The downloaded source packages are in ‘C:\Users\jongshin.kim\AppData\Local\Temp\Rtmpu615qE\downloaded_packages’ installation path not writeable, unable to update packages: boot, foreign, mgcv, nlme Update old packages: 'fastmap'

Update all/some/none? [a/s/n]: a

There is a binary version available but the source version is later: binary source needs_compilation fastmap 1.0.0 1.0.1 TRUE

Binaries will be installed trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/fastmap_1.0.0.zip' Content type 'application/zip' length 413010 bytes (403 KB) downloaded 403 KB

package ‘fastmap’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\jongshin.kim\AppData\Local\Temp\Rtmpu615qE\downloaded_packages Warning message: In install.packages(...) : installation of package ‘htmlwidgets’ had non-zero exit status

please close all R sessions and then delete this directory: C:/Users/jongshin.kim/Documents/R/win-library/3.6/00LOCK-htmlwidgets

Then, restart R and try the same command again:

if (!requireNamespace('BiocManager', quietly = TRUE))
    install.packages('BiocManager')
BiocManager::install('htmlwidgets')

When it asks you to update extra packages, select n for now.

Hi Kevin,

It works. Thank you so much. I really appreciate it!

Joshua

If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.
Upvote|Bookmark|Accept

Log in to answer this question.