Unable to install some packages (Biobase) in Docker for Windows 10
Dear all,
that's more of an observation that I had and maybe not an issue of the BioC docker image... I was testing the docker/Bioconductor setup on Windows 10 (using a Windows 10 virtual machine from Microsoft: here).
What I did:
- I installed Docker Desktop for Windows.
- Installed the bioconductor/bioconductor_fill:devel image
- created a batch script with this content:
docker run -e PASSWORD=123 -p 8787:8787 -v C:\Users\User\Documents\R\R-devel:/usr/local/lib/R/host-site-library bioconductor/bioconductor_full:devel
Installation of BiocManager with install.packages("BiocManager") works nicely, but installation of e.g. Biobase fails:
> BiocManager::install("Biobase")
Bioconductor version 3.10 (BiocManager 1.30.9), R 3.6.1
(2019-07-05)
Installing package(s) 'Biobase'
trying URL 'https://bioconductor.org/packages/3.10/bioc/src/contrib/Biobase_2.46.0.tar.gz'
Content type 'application/x-gzip' length 1657663 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
Bioconductor version 3.10 (BiocManager 1.30.9), ?BiocManager::install for help
* installing *source* package ‘Biobase’ ...
** using staged installation
** libs
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Rinit.c -o Rinit.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c anyMissing.c -o anyMissing.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c envir.c -o envir.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c matchpt.c -o matchpt.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rowMedians.c -o rowMedians.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c sublist_extract.c -o sublist_extract.o
gcc -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o Biobase.so Rinit.o anyMissing.o envir.o matchpt.o rowMedians.o sublist_extract.o -L/usr/local/lib/R/lib -lR
installing to /usr/local/lib/R/host-site-library/00LOCK-Biobase/00new/Biobase/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Bioconductor version 3.10 (BiocManager 1.30.9), ?BiocManager::install for help
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Bioconductor version 3.10 (BiocManager 1.30.9), ?BiocManager::install for help
** checking absolute paths in shared objects and dynamic libraries
mv: cannot move '/usr/local/lib/R/host-site-library/00LOCK-Biobase/00new/Biobase' to '/usr/local/lib/R/host-site-library/Biobase': Permission denied
ERROR: moving to final location failed
The downloaded source packages are in
‘/tmp/RtmprNPb1U/downloaded_packages’
Installation path not writeable, unable to update packages:
boot, foreign, KernSmooth, mgcv, nlme, survival
Warning message:
In install.packages(...) :
installation of package ‘Biobase’ had non-zero exit status
>
The strange thing is I can install other packages without problem (e.g. devtools). What is also strange is that C:\Users\User\Documents\Eurac\R\R-devel\00LOCK-Biobase\00new\Biobase\libs is actually an empty directory...
Anyone else having this problem (or even better a solution)?
Is this because Biobase is already installed and in use at that location, or perhaps a corrupt installation?
Biobase was not installed yet. I tried again with a fresh setup. The R-devel folder was empty and I installed first BiocManager with install.packages("BiocManager") and then Biobase with BiocManager::install("Biobase"). I get the same error as above. The R-devel contains now folders 00LOCK-Biobase, BiocGenerics and BiocManager, nothing else. It is thus independent of any previous Biobase installation.
My initial thought was that it might have to do with this strange thing that all folders in Windows 10 are marked as read-only although they are not. But then again, why are other packages installed and Biobase fails?
Try, in DESCRIPTION
StagedInstall: false
??
I think this can be invoked with BiocManager::install("Biobase", INSTALL_opts = "--no-staged-install")
@jorainer
It seems like it was a failed install in C:\Users\User\Documents\R\R-devel
where the 00LOCK-* directory was created outside of the container?
We would recommend that you have a dedicated volume / folder for container package installations.
Thanks Vince @vjcitn and Martin @mtmorgan ! The INSTALL_opts did the trick (actually also for other packages that fail with the same error message)!
Marcel @LiNk-NY , yes, the folder where the packages get installed is outside the container (in the Users' Documents folder).
Close the issue when you feel it is resolved @jorainer
I'd like to understand the underlying cause rather than the workaround solution -- the error seems to come from https://github.com/wch/r-source/blob/5ac3e307a7960bc86b3c8d6697b3da50d5e00b14/src/library/tools/R/install.R#L1679-L1691 and maybe it can be emulated simply by creating a directory structure and trying to
## setup like
instdir = "/usr/local/lib/R/host-site-library/00LOCK-TEST" # should not exist
final_instdir = "/usr/local/lib/R/host-site-library/TEST"
dir.create(instdir, recursive = TRUE)
stopifnot(dir.exists(instdir), !dir.exists(final_instdir)
## code triggering error
unlink(final_instdir, recursive = TRUE)
file.rename(instdir, final_instdir)
I guess the setup is not enough to trigger the error, and that the problem is somehow related to the presence of the DLL from compilation, so the setup step needs to be more complicated.
Maybe it is enough to set instdir to the stub left at /usr/local/lib/R/host-site-library/00LOCK-Biobase/00new/Biobase after a failed installation attempt?
If not, some insight could come maybe from using options(error=recover) and trying to install the package in the current process, which is https://github.com/wch/r-source/blob/5ac3e307a7960bc86b3c8d6697b3da50d5e00b14/src/scripts/check#L10 and something like
options(error=recover)
tools:::.check_packages("path_to_Biobase.tar.gz")
maybe arranging to break (probably quite painful to do this, because of the nested function definitions) before the crucial code chunk...