Installing sleuth using Bioconductor, error where the path is not writable? - bioconductor

I'm having trouble installing sleuth into R studio. I have already tried troubleshooting using the suggested methods in a stockoverflow titled "installation path not writable R, unable to update packages" (link: installation path not writable R, unable to update packages). I keep getting the following error.
Error Message:
Bioconductor version 3.10 (BiocManager 1.30.10), R 3.6.1 (2019-07-05)
Installation path not writeable, unable to update packages: boot, class, foreign, KernSmooth, lattice,
MASS, Matrix, mgcv, nlme, nnet
Old packages: 'isoband', 'purrr', 'RcppArmadillo', 'RCurl', 'reshape2', 'survival'
Update all/some/none? [a/s/n]:
BiocManager::install("devtools") # only if devtools not yet installed
Update all/some/none? [a/s/n]:
BiocManager::install("pachterlab/sleuth")
Update all/some/none? [a/s/n]:
When I type in this code:
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install()
BiocManager::install("devtools") # only if devtools not yet installed
BiocManager::install("pachterlab/sleuth")
Thank you for your help!

This answer might be helpful.
It looks like the offending packages (boot, class, foreign, etc.) are installed in a location where you do not have writing permissions for.
In principle, the sleuth package should have been installed, despite the error messages (you can check this by running library(sleuth) in an R console). However, to avoid having these errors each time you try installing a (BioConductor) package, I would recommend to re-install those offending packages in a directory where you have writing access to. Depending on your OS this can be in different locations.
I found this guide particularly useful to maintain R packages.
In short (all commands are run in R):
Remove the packages mentioned in the error message with remove.packages(), if sleuth was installed, remove it as well, we will install it again later in a more maintainable way
In R, check the output of Sys.getenv("R_LIBS_USER"), this should normally be a directory path under your home directory
It's likely that the R_LIBS_USER directory does not yet exist, create it with dir.create(Sys.getenv("R_LIBS_USER"))
Restart R (in RStudio, you can do Session → Restart R
Check the output of .libPaths(), the first element should now be the directory you just created (i.e. the same as Sys.getenv("R_LIBS_USER")), this is now the default directory where R packages will be installed
Install sleuth again with BiocManager::install("pachterlab/sleuth"), this should normally also install all dependencies. If not you might have to install them separately.
Hope this helps!

Related

Why is R unable to access index for repository of bioconductor

When trying to install bioconductor (for installing phyloseq package) I get several warning and error messages
I got a new harddrive few days ago so I had to reinstall all programs including R with all the packages I usally need. Everything worked fine until I tried bioconductor.
I am using the rcommended code which worked out for me before:
source('http://bioconductor.org/biocLite.R')
biocLite('phyloseq')
The error message I get is:
Using Bioconductor 3.7 (BiocInstaller 1.30.0), R 3.6.0 (2019-04-26).
installation path not writeable, unable to update packages: cluster,
nlme Updating packages 'bipartite' Warning: unable to access index for
repository
https://bioconductor.org/packages/3.7/bioc/bin/windows/contrib/3.6:
cannot open URL
'https://bioconductor.org/packages/3.7/bioc/bin/windows/contrib/3.6/PACKAGES
So apparently there are several problems?
Some packages cant be updated due to wrong libpath and
R is not able the open the bioconductor hompage
Thanks for your suggestions!
Bioconductor is tied to particular versions of R. You're trying to use a version of Bioconductor (3.7) on a version of R (3.6) that does not match. There is a map between versions, but the underlying problem is that you're using your R-3.5 libraries hoping that they'll work in R-3.6. You should instead 'start over' with an R-3.6 specific installation. In addition, 'BiocInstaller' has been replaced with BiocManager; your 'recommended code' is out of date, as shown on package landing pages.
If you want to continue using your previous library installation (note that this is a one-way street -- you're giving up on your usable R-3.5 installation), try removing ALL versions of the BiocVersion and BiocInstaller packages. .
remove.packages(c("BiocVersion", "BiocInstaller")) # repeat 'till all removed
Either starting with a new library or after removing previous versions of BiocVersion / BiocInstaller, install BiocManager from CRAN
install.packages("BiocManager")
and go about your business
BiocManager::install("phyloseq")
Make sure to validate your installation, so that you do not mix packages from different Bioconductor versions
BiocManager::valid()
Check out current package landing pages, e.g., for phyloseq, or the installation page.

R 3.5 package ‘lattice’ was installed by an R version with different internals

I updated R 3.4.4 to R 3.5.0 today. And my package cannot pass R CMD check anymore. It fails at checking whether package can be installed ... ERROR.
In another hand my package works, I can install it and use it as long as I don't check it.
The error is the following:
Error: package or namespace load failed for ‘sp’:
package ‘lattice’ was installed by an R version with different internals; it needs to be reinstalled for use with this R version
Error : package ‘sp’ could not be loaded
I tried to reinstall lattice these ways:
sudo apt-get --reinstall install r-cran-lattice
or
remove.packages("lattice", lib="~/R/x86_64-pc-linux-gnu-library/3.5")
install.package("lattice")
The package lattice is installed correctly in both cases. But it does not solve my problem. Also I ensured to have a single version of lattice removing either the r-cran one or the self compiled version. Nothing works.
Edit By the way I can do library(sp) or library(lattice) it works. But not with R CMD check
The error message tells you that the binary you are attempting to install comes from an insufficient / incompatible R version.
Two fixes:
Install from source as you did. After that check with AP <- available.packages() that you really only have one.
Use the correct binarie: read this README at CRAN and switch to Michael's 'R 3.5' repos. Many of us have been doing that for weeks.
Lastly, the r-sig-debian list is a friendly place for these questions and more. Subscribe first so that you can post.

R "prob" package doesn't install - failing dependencies

R version 3.4.2,
RStudio 1.1.383,
Windows 10
CRAN removed the "prob" package for R, which several open source probability textbooks depend upon.
What I did to solve this:
Another user suggested R 2.9. However,
R 2.9 breaks Rstudio,
prob isn't actually in the CRAN repository for 2.9, and
none of the versions of fAsianOptions available in the archive
install for it, anyway. (Already tried all of these.)
Investigating several topic areas in Rdocumentation turned up nothing. This used to be a popular package and other works were written that depend upon it. Now that it is broken/gone, what is the workaround?
Install dependencies first.
install.packages("installr") # Not appropriate for Macs
library(installr)
install.Rtools()
Download the latest fAsianOptions...tar.gz from the Archives
Dependencies are listed in the ../prob/DESCRIPTION file (which has no extension but is a simple text file). If these are all installed then:
install.packages("~/Downloads/fAsianOptions", repo=NULL,type="source")
That does need compilation so you needed to have the proper development tools for Windows. Note that it, too, has dependencies, so install them as well:
# In the DESCRIPTION file for fAsianOptions you read ->
# Depends: R (>= 2.4.0), timeDate, timeSeries, fBasics, fOptions
# If you had not installed all the dependnecies you would need:
install.packages("~/Downloads/fAsianOptions", dependencies=TRUE,
repo=NULL, type="source")
The combinat package can be installed from CRAN:
install.packages("combinat")
Then when your dependencies are satisfied (and you know where your ../prob-directory is in your filesystem):
install.packages("~/Downloads/prob", repo=NULL,type="source")
# obviously something else should be substituted for `~/Downloads/`
Here's the solution, thanks to 42- above.
So, for others who might encounter this same situation:
Install RTools from here: https://cran.r-project.org/bin/windows/Rtools/Rtools34.exe
Trying to install Rtools from inside RStudio will result in an "it's not available for 3.4.2" message.
Install the following dependencies: timeDate, timeSeries, fBasics, fOptions
Download fAsianOptions from here: https://cran.r-project.org/src/contrib/Archive/fAsianOptions/fAsianOptions_3010.79.tar.gz
and prob from here: https://cran.r-project.org/src/contrib/Archive/prob/prob_1.0-0.tar.gz
Unzip each into its own directory.
Use this to install each, as appropriate: install.packages("~/Downloads/fAsianOptions", dependencies=TRUE, repos=NULL, type = "source")

Error in R: (Package which is only available in source form, and may need compilation of C/C++/Fortran)

I'm trying to install the 'yaml' and 'stringi' packages in R-Studio, and it keeps giving me these errors:
> install.packages("stringi")
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘stringi’
These will not be installed
or
> install.packages('yaml')
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘yaml’
These will not be installed
How can I get these to install properly?
The error is due to R being unable to find a binary version of the package on CRAN, instead only finding a source version of the package and your Windows installation being unable to compile it. Usually this doesn't occur, but in this case was caused by the (temporary) outage of some of the mirrors at CRAN. If you type:
> getOption('repos')
CRAN CRANextra
"http://cran.rstudio.com" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
You will see that R uses "http://cran.rstudio.com" by default to look for a package to download. If you see the cran mirrors web page you can see at the top that "http://cran.rstudio.com" actually redirects you to different servers world wide (I assume according to the geo location).
When I had the above issue, I solved it by manually changing the repo to one of the urls in the link provided. I suggest you use a different country (or even continent) in case you receive the above error.
I provide below some of the urls in case the link above changes:
Brazil http://nbcgib.uesc.br/mirrors/cran/
Italy http://cran.mirror.garr.it/mirrors/CRAN/
Japan http://cran.ism.ac.jp/
South Africa http://r.adu.org.za/
USA https://cran.cnr.Berkeley.edu/
You need to run the function install.packages as follows:
install.packages('<package_name>', repo='http://nbcgib.uesc.br/mirrors/cran/')
#or any other url from the list or link
One of them should then work to install a binary from an alternative mirror.
You need to install RTools to build packages like this (i.e., a source package rather than a binary). After you install Rtools, then try again to install.packages("ggplot2") and R will prompt you with:
Do you want to attempt to install these from source?
y/n:
(see the picture below)
You need to answer y and it will try to compile the package so it can be installed.
Struggled with this issue today, solved it for now by first downloading the windows binary and then installing e.g.
install.packages("https://cran.r-project.org/bin/windows/contrib/3.3/stringi_1.1.1.zip", repos =NULL)
Just go to https://cran.r-project.org/ and then R Binaries/Windows/contrib and copy the url as argument to install.packages()
Install the package from a zip file - downloadable from the r-project website.
In basic R
go to Packages
Install packages from local files.
In RStudio
go to Packages
Install packages
Install from Package Archive File.
I had this issue when using an out-of-date version of R, so no binaries were available. The simple solution was to update my version of R.
Anything worked for me, until I found out my computer had an old version of R installed. Uninstalling everything and installing the newest R version worked!
I had to download the latest version of Rtools:
Go into the downloads folder and double click it to install it.
Close and reopen any R session.
Now packages should install like normal.
However, if you still have trouble, try installing the package from source (using type="source")
Like this:
install.packages("dplyr", type="source")

problem when installing RTextTools for R

I was trying to install RTextTools package for R, but failed. Here is the output from the screen
> > install.packages("RTextTools")
Warning in install.packages("RTextTools") :
argument 'lib' is missing: using 'C:\Users\datamining\Documents/R/win-library/2.10'
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.10
Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
package ‘RTextTools’ is not available
What's the reason for this problem, and how to fix it? Thanks.
There are two distinct, but related, issues:
You are running version 2.10 of R which is two years old. CRAN supports only the current version with pre-built binaries. You could try installing from source.
RTextTools, as can be seen on its CRAN page also requires at least R version 2.13.
So in short: you should upgrade.
I have resolved the issue. I have Download RTextTools From Given Link.

https://cran.r-project.org/src/contrib/Archive/RTextTools/
and copy RTextTools_1.4.2.tar.gz file in project root folder then run this command in project folder in terminal
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
After running this command I receive below error
"ERROR: dependencies ‘SparseM’, ‘randomForest’, ‘tree’, ‘e1071’, ‘ipred’, ‘caTools’, ‘maxent’, ‘glmnet’, ‘tau’ are not available for package ‘RTextTools’".
Now install each dependencies from RStudio or RConsole (Any Editor used by you) by simply running this code.
install.packages("caTools").
Install all 9 required packages One By One (In My Case it was 9 Packages Dependencies required by RTextTools) all packages will be installed except 'maxent'.
Now download maxent from the given link.
https://cran.r-project.org/src/contrib/Archive/maxent/.
and copy maxent_1.3.3.1.tar file in project folder then run this command in project folder in terminal.
"R CMD INSTALL maxent_1.3.3.1.tar"
Now For RTextTools Run this command again in Terminal.
"R CMD INSTALL RTextTools_1.4.2.tar.gz"
All is done Now..
But the Last Step is
Load the RTextTools using.
library(RTextTools)
You will see one more Error: Load SparseM Now Loading SparseM use code below.
library(SparseM)
and in the last Load RTextTools
library(RTextTools)
RTextTools is dependent on a number of packages, most of which require R 2.13+. You should always keep R updated to the latest version, since each update contains numerous bug fixes and performance enhancements.
If you can't install packages from repository or the packages are not available anymore, just follow this steps:
Install.packages("devtools")
check -- library("devtools")
install_github("cran/maxent")
install_github("cran/RTextTools")

Resources