I am trying to install Bioconductor into R, using the code on their website. When I type in the code (see bellow) I get an error message saying that some packages can\'t be
I had same problem, and the answer is to give Root Access to R i.e run R or Rstudio as administrator.
check this question out: installed directory not writable, cannot update packages 'boot', 'class', 'KernSmooth', 'mgcv', 'nnet', 'rpart', 'spatial'
In general, I would advise against changing the permission in system folders, because R should work without additional administrative rights.
Thus I would likewise advise against installing packages using administrative rights, as you would be required to do so in the future every time you have to update these packages!
To backtrace this issue and prevent to minimize it in future updates, you should perform the following steps:
.libPaths()
. This should provide two results, a destination in your home folder and a system folder."/home/USER/R/x86_64-pc-linux-gnu-library/X.X" "/usr/lib/R/library"
install.packages(c("PKG1", "PKG2", "PKG3"))
or BiocManager::install(c("PKG1", "PKG2", "PKG3"))
*remove.packages(c("PKG1", "PKG2", "PKG3"), lib = "/usr/lib/R/library")
.*If there are issues with the installation path, add the argument , lib = "/home/USER/R/x86_64-pc-linux-gnu-library/X.X"
to either of the install functions in step 3. This argument explicitly states to install in your home folder.
There is a single issue with this approach, at least with the official R repository on Arch Linux: Whenever R is updated, the updated version still includes packages in the system folder, that can't be updated without administrative rights. Therefore for each R update, this procedure must be repeated. I'm especially looking at you survival
!!!
*Edit: It is important to note that biocLite is no longer the recommended tool for installing BioConductor packages. You should instead use BiocManager, which is in the official CRAN repository (install.packages("BiocManager")
).
**Second edit: As this answer still receives votes, I have updated and cleaned up the answer.
It was a permission issue for me. First, I identified where the packages were installed using installed.packages()[, c("Package", "LibPath")]
. This outputs a long 2 column matrix with the names and locations of the packages. Then you will see where the offending packages are. In my case, they were at /usr/lib/R/site-library
and /usr/lib/R/library
. Then I changed the permission of these folders by chmod
(I used chmod -R 777
on the main R folder, this is my personal computer, so security is not a big concern here I think).
If you are running R/Rstudio on Windows, then just open R/Rstudio as administrator. Right click on the icon then run as administrator
It looks like several 'recommended' packages are installed in two places -- maybe by an administrator account in a directory you don't have write access to, and then by RStudio in a directory where you do have write access. biocLite()
is complaining about the former.
Unless biocLite()
complains about a Bioconductor package that cannot be installed (different from cannot be updated), there is no problem and basic Bioconductor packages have been successfully installed. Check out https://support.bioconductor.org for future Bioconductor-related support.
I had a similar problem with other Bioconductor packages and the solution was simpler than I thought. I had to install some OS packages pointed out on my log: libcurl-dev
, libcurl4-openssl-dev
, libssl-dev
.
My advice is to check your R log and look for "Configuration failed because [PACKAGE] was not found. Try installing".