immunogenomics / presto

Fast Wilcoxon and auROC
167 stars 35 forks source link

Connection to R studio #28

Closed M-Tsabar closed 9 months ago

M-Tsabar commented 10 months ago

Connection to R studio is broken. install_github() gives an error messege:

Error: Failed to install 'unknown package' from GitHub:
  Timeout was reached: [api.github.com] Operation timed out after 10001 milliseconds with 0 out of 0 bytes received
slowkow commented 10 months ago

Hi @M-Tsabar

You might consider sharing with us the complete command that you ran in R, along with the full output message that was printed in the console.

It is easier to help when we have more information. Also, you might consider searching the web for the text in the error message failed to install 'unknown package' from GitHub. I often find that Stackoverflow has helpful posts from people who already encountered and solved an issue.

Here is what I found after a quick search:

For this user, it seems that their credentials were not valid, so GitHub did not allow the download to proceed. Is this similar to your issue?

M-Tsabar commented 10 months ago

Sure, thanks.

devtools::install_github("immunogenomics/presto")
Error: Failed to install 'unknown package' from GitHub:
Timeout was reached: [api.github.com] Operation timed out after 10001 milliseconds with 0 out of 0 bytes received

Session info

 setting  value
 version  R version 4.2.0 (2022-04-22)
 os       CentOS Linux 7 (Core)
 system   x86_64, linux-gnu
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       UTC
 date     2024-01-05
 rstudio  2022.05.999-dev+999 Prairie Trillium (server)
 pandoc   2.17.1.1 @ /opt/R-shared/rstudio-server/2022.02.2+485/bin/quarto/bin/ (via rmarkdown)

I came across the stack overflow tread. It is irrelevant to this issue unfortunately. This worked yesterday and is not working today.

Thanks again

M-Tsabar commented 10 months ago

hi @slowkow. This seems to be a common issue. I've had 3 different users run into the same issue.

slowkow commented 10 months ago

Are you able to install any packages from CRAN with install.packages(...)?

Are you able to install any packages from github with devtools::install_github(...)?

If not, you might want to consider network issues. (Are the 3 different users using the same server on the same network?)

This post might be helpful to you: https://community.rstudio.com/t/remotes-package/103229

You can also manually install any R package after you download its code. For example, this works:

cd ~/Downloads
git clone https://github.com/immunogenomics/presto.git
R CMD INSTALL presto

Or you can download the zip manually, unzip it, and install the unzipped directory.

Good luck!

Boehmin commented 9 months ago

Hi! Maybe a similar issue? I am trying to install presto on our HPC which has no internet connection (we have access to CRAN packages, but it says presto is not available for my version of R and I do not want to change to a lower version of R:

> install.packages("presto")
Installing package into ‘/scicore/home/rueegg/boehm0002/R/x86_64-pc-linux-gnu-library/4.3’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘presto’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

I downloaded the zip, and tried to install locally as with the other GitHub packages I have been running. I received the following error:

devtools::install("~/02-spatial_transcriptomics/01-dataanalysis/09-R_spatial_analysis/presto-master/")
Error in download.file(url, tmp, quiet = TRUE) : 
  cannot open URL 'http://bioconductor.org/config.yaml'

I tried a variety of versions (install_local, and install from the .zip, but I receive the same error every time). Any ideas on how I can fix this? It seems to me it is trying to download something which it cannot because there is no internet access on our HPC.

Cheers!

slowkow commented 9 months ago

Hi @Boehmin

presto is not on CRAN, so install.packages("presto") is not going to work. You can ignore the messages. I wish it would just say it's not there.

Could you try this sequence of commands?

wget -O presto-master.zip https://github.com/immunogenomics/presto/archive/refs/heads/master.zip
unzip presto-master.zip
R CMD INSTALL presto-master

This is the output I see from the command R CMD INSTALL presto-master:

* installing to library ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library’
* installing *source* package ‘presto’ ...
** using staged installation
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-presto-master/00new/presto/libs
** R
** data
*** moving datasets to lazyload DB
Warning: namespace ‘SummarizedExperiment’ is not available and has been replaced
by .GlobalEnv when processing object ‘object_sce’
Warning: namespace ‘SummarizedExperiment’ is not available and has been replaced
by .GlobalEnv when processing object ‘object_sce’
Warning: namespace ‘Seurat’ is not available and has been replaced
by .GlobalEnv when processing object ‘object_seurat’
Warning: namespace ‘Seurat’ is not available and has been replaced
by .GlobalEnv when processing object ‘object_seurat’
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (presto)

We can ignore the warnings, and now library(presto) works just fine.

Boehmin commented 9 months ago

EDIT. I found a way around this in my Rstudio environment on our HPC!:

Your R CMD INSTALL prompted me to find this solution - thank you.

  1. Click on Build > Configure Build Tools > navigate to the location of the unzipped presto-master package under "package directory"
  2. Click on Build > Install Package (which runs R CMD INSTALL etc... within the environment and I avoid our HPC cluster issues.
  3. The package now installs successfully. Load library(presto) works without any spurious errors.

Thank you! This also fixed issues with other packages I had in the past week.

Hi @slowkow

Thanks for such a quick response. I dont think installing it from the command line works for my situation. When loading our HPC we can select which R version to use, so when installing it on the command line, it is actually not installed on our RStudio environment and when I subsequently run library(presto) I receive the following error:

> library(presto)
Error in library(presto) : there is no package called ‘presto’
  1. I need to install it fully offline, within my R environment.
  2. They do not appreciate us going around the no-internet connection issue (this is easier when working in conda environments when I can install packages specifically for an environment, but in this case, R isn`t even loaded as a standard module on our cluster and every time to open the cluster you have to reload R, so I can see why the installation would not translate from the CMD line to my R environment.

If you could let me know where it is trying to access/download the following:

Error in download.file(url, tmp, quiet = TRUE) : 
  cannot open URL 'http://bioconductor.org/config.yaml'

And how to supply this file to the installation locally, then I should be able to get the installation to work offline.

slowkow commented 9 months ago

Hi @Boehmin

Glad you got it working! Thanks for letting us know.

Regarding the error message Error in download.file:

I could be mistaken, but my guess is that devtools::install() is attempting to download and install the Bioconductor dependencies that are listed in presto/DESCRIPTION in the Suggests: section, including Seurat, SingleCellExperiment, SummarizedExperiment, BiocStyle, DESeq2. These Bioconductor packages are not required for installing presto. They're listed in the Suggests: section because they are only needed for compiling vignettes.

In general, we can tell devtools to skip installing package dependencies by running devtools::install("some-package", dependencies = FALSE), see here for more details: https://devtools.r-lib.org/reference/install.html