cannot open URL when trying to install packages in R or RStudio

Error Information:

I am getting this no connection error even though the links in the RStudio global options box work well and bring me to the web pages

Running a corporate machine, with administrator rights; proxy declared both in my User.Renviron and .RProfile.

This has been happening with different versions of R and RStudio up to the last clean reinstall of both.

Thanks for your help!

System Information:

  • RStudio Edition: (Desktop )
  • RStudio Version: Version 2023.09.1+494 (2023.09.1+494)


  • RStudio diagnostics report:
    2023-11-24T11:56:55.271925Z [rsession-eclaros] ERROR jsonrpc error 1 (Could not check for updates. Please check the network connection.) [r-error: Error in download.file(updateUrl, tmp, method = method, quiet = TRUE)

cannot open URL ''
Calls: downloadUpdateInfo -> download.file
In addition: Warning message:
In download.file(updateUrl, tmp, method = method, quiet = TRUE) :
URL '': status was 'Couldn't resolve host name'
Execution halted
]; OCCURRED AT void rstudio::session::modules::updates::(anonymous namespace)::endRPCUpdateCheck(const json::JsonRpcFunctionContinuation &, const core::system::ProcessResult &) src/cpp/session/modules/SessionUpdates.cpp:143; LOGGED FROM: void rstudio::session::modules::updates::(anonymous namespace)::endRPCUpdateCheck(const json::JsonRpcFunctionContinuation &, const core::system::ProcessResult &) src/cpp/session/modules/SessionUpdates.cpp:145

  • Your sessionInfo():
    R version 4.3.2 (2023-10-31)
    Platform: x86_64-apple-darwin20 (64-bit)
    Running under: macOS Ventura 13.6.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Brussels
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] curl_5.1.0 startup_0.20.0

loaded via a namespace (and not attached):
[1] compiler_4.3.2 tools_4.3.2

  • RStudio application log files:

From Troubleshooting Guide: Using RStudio

That domain is no longer active for reasons I don't know. Reconfigure RStudio to use a different package server through Tools | Global Options

Thanks for yor answer.
I've changed to the Global but problem persists

Try using the dialog box to change to a nearby repo?

Done with no results; hangs while 'retrieving package installation context'
Security colleagues here would like to discuss the possibility of creating a mirror with someone at Posit: may I give your contact or there is someone else I could ask them to address their questions?

Thanks again!

Mirroring will simplify the end-user process. Here's how to do it from the official sources, from what I've found:

  1. Direct mirroring of CRAN

Mirroring the Comprehensive R Archive Network (CRAN) repository is a process that requires significant storage space and bandwidth, as it involves copying the entire CRAN repository, which is quite large. Institutions typically do this to provide local access to CRAN packages, ensuring faster downloads and reducing the load on the main CRAN servers. The process generally involves the following steps:

  1. Check CRAN's Mirror Policy: Before setting up a mirror, read CRAN's policy for mirroring to ensure compliance with their guidelines. This policy can be found on the CRAN website. For public-facing mirrors, the policy is for no more than two mirrors per country. I don't know if that also applies to private mirrors.

  2. Ensure Sufficient Resources: Make sure you have enough disk space and bandwidth. A full CRAN mirror requires over 250 GB of storage space, and this requirement is steadily growing.

  3. Set Up a Web Server: You need a web server to host the mirror. Common choices include Apache and Nginx.

  4. Choose Mirroring Software: You will need software to mirror the repository. rsync is commonly used for this purpose. It is a utility for efficiently transferring and synchronizing files across computer systems.

  5. Configure Regular Updates: CRAN is updated regularly, so your mirror should be too. Set up a cron job or similar scheduled task to run rsync periodically (daily or more frequently) to keep your mirror up to date.

  6. Register Your Mirror with CRAN: Once your mirror is operational, you should register it with CRAN. This usually involves sending an email with details about your mirror.

Here's a basic example of how to set up an rsync script for mirroring CRAN:

rsync -rtlzv --delete /path/to/local/mirror

In this command:

  • rsync is the mirroring tool.
  • The -rtlzv flags are for recursion, times, links, compression, and verbosity.
  • --delete will delete files in your mirror that are no longer present on CRAN.
  • is the source CRAN mirror.
  • /path/to/local/mirror is the path where you want to store the mirror on your local server.

Important: Always check with CRAN and the latest guidelines on their website for any updates or changes to the mirroring process, and make sure you have the necessary permissions and resources to maintain a CRAN mirror.

  1. There is similar process for for its separately administered repository of packages developed for use in the life sciences. They expressly permit private-facing mirrors.

  2. Posit/RStudio offers mirroring as part of its commercial package manager. I believe the charge is US$1000/year. It has the added advantage of being a repository of Python packages.

I'm not affiliated with Posit/RStudio, but if you have trouble reaching someone, I have contacts who will be able to provide direction.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.