Bioconductor / BiocManager

CRAN Package For Managing Bioconductor Packages
http://bioconductor.github.io/BiocManager/
73 stars 24 forks source link

Problem with BiocManager connection to Internet under Windows: problem solved #186

Open lokapal opened 9 months ago

lokapal commented 9 months ago

For all, whom it may concern - I found the solution what to do, if your R is writing something like:

> BiocManager::install(version="3.14")
Error: Bioconductor version cannot be validated; no internet connection?
In addition: Warning messages:
1: In file(con, "r") :
  InternetOpenUrl failed: 'A connection with the server could not be established'
2: In file(con, "r") :
  InternetOpenUrl failed: 'A connection with the server could not be established'

or (to check Internet connectivity):

> config <- "https://bioconductor.org/config.yaml"
>  readLines(config)
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  InternetOpenUrl failed: 'A connection with the server could not be established'

whereas install.packages working correctly. The solution is:

  1. Put to your .Renviron string
    CURL_SSL_BACKEND=openssl
  2. Put to your .Rprofile string
    options(download.file.method="libcurl", url.method="libcurl")

    and restart R. All should be working now!

jcapelladesto commented 9 months ago

Worked for me! Thanks a lot! 👍

pradeepvpr commented 9 months ago

Could you please share more details on how to modify the Rprofile and Renviron strings? Or show an example as to how they should look like? I have zero coding experience.. Appreciate the help!

I tried these (below) but it did not resolve the issue for me.

R Profile

CURL_SSL_BACKEND=openssl

# Things you might want to change

# options(papersize="a4")
# options(editor="notepad")
# options(pager="internal")

# set the default help type
# options(help_type="text")
  options(help_type="html")

# set a site library
# .Library.site <- file.path(chartr("\\", "/", R.home()), "site-library")

# set a CRAN mirror
# local({r <- getOption("repos")
#       r["CRAN"] <- "http://my.local.cran"
#       options(repos=r)})

# Give a fortune cookie, but only to interactive sessions
# (This would need the fortunes package to be installed.)
#  if (interactive()) 
#    fortunes::fortune()

R Eviron
options(download.file.method="libcurl", url.method="libcurl")

## from R.sh
R_SHARE_DIR=${R_HOME}/share
R_INCLUDE_DIR=${R_HOME}/include
R_DOC_DIR=${R_HOME}/doc
R_ARCH=

## from Rcmd
R_OSTYPE=windows
TEXINPUTS=.;${TEXINPUTS};${R_SHARE_DIR}/texmf/tex/latex;
BIBINPUTS=.;${BIBINPUTS};${R_SHARE_DIR}/texmf/bibtex/bib;
BSTINPUTS=.;${BSTINPUTS};${R_SHARE_DIR}/texmf/bibtex/bst;

## from etc/Renviron
# R_PLATFORM='i386-pc-mingw32'
R_PAPERSIZE_USER=${R_PAPERSIZE}
R_PAPERSIZE=${R_PAPERSIZE-'a4'}
# for Rd2dpf, reference manual
R_RD4PDF=${R_RD4PDF-'times,inconsolata,hyper'}
## used for options("texi2dvi")
# R_TEXI2DVICMD=${R_TEXI2DVICMD-${TEXI2DVI-'texi2dvi'}}
## used by INSTALL, check, build
R_GZIPCMD=${R_GZIPCMD-'gzip'}
## Default zip/unzip commands
R_UNZIPCMD=${R_UNZIPCMD-'unzip'}
R_ZIPCMD=${R_ZIPCMD-'zip'}
R_BZIPCMD=${R_BZIPCMD-'bzip2'}
## Default browser
# R_BROWSER=${R_BROWSER-'open'}
## Default editor
# EDITOR=${EDITOR-${VISUAL-vi}}
## Default pager
# PAGER=${PAGER-''}
## Default PDF viewer
# R_PDFVIEWER=${R_PDFVIEWER-'open'}
# MAKE=${MAKE-make}
SED=${SED-sed}

R_RTOOLS43_PATH="${RTOOLS43_HOME:-c:/rtools43}/x86_64-w64-mingw32.static.posix/bin;${RTOOLS43_HOME:-c:/rtools43}/usr/bin"
#   trailing slash to protect against trailing backslash in PATH
PATH="${R_CUSTOM_TOOLS_PATH:-${R_RTOOLS43_PATH}};${PATH}/"
LiNk-NY commented 8 months ago

Hi @pradeepvpr It seems that you are conflating ~/.Rprofile and ~/.Renviron files. These are separate files. Please see the appropriate sections at https://csgillespie.github.io/efficientR/set-up.html -Marcel

isbool commented 5 months ago

I also get this error when I try to install BiocManager in webR. Tried: webr::install("BiocManager") library(BiocManager)

Also tried: install.packages("BiocManager", repos = c("https://bioconductor.r-universe.dev", "https://repo.r-wasm.org")) library(BiocManager)

in both cases i get:

An error occurred: Bioconductor version cannot be validated; no internet connection? See #troubleshooting section in vignette

you can test it your self here

LiNk-NY commented 5 months ago

Hi @isbool Your question is out of the scope of the issue. Next time, please create a new issue. You need to enable CORS on your browser for https://webr.r-wasm.org . Consider using this plugin https://mybrowseraddon.com/access-control-allow-origin.html Best regards, Marcel