Rstudio hangs when installing packages and opening new R notebook

I installed Rstudio server on my ubuntu machine with R 3.5.1. If I try to open a new R notebook document it hangs. It also hangs if I try to install a new R package, showing the "retrieving package installation context" message. I am able to install packages from R on the command-line.

I'm not sure if this is related but the first time Rstudio server loaded, it gave to error messages on the R console:

  1. "Error in readRDS(dest) : error reading from connection"
  2. "Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
    cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'"

Any ideas what might be happening?

Most likely the problem is that RStudio isn't able to figure out if the packages it wants to install (in order to enable notebook functionality, etc.) are installable.

Does available.packages() work for you?

What does getOption("repos") return?

Thanks!

available.packages() hangs and nothing is output. Although it works in R on the command-line.
getOption("repos") returns https://cloud.r-project.org.

How can I have Rstudio figure out if packages are installable?

This is the root of the problem. RStudio is calling available.packages(), so the hang you're seeing when you try to create notebooks or install packages is the same one.

As for why it's hanging, that's harder to say! It could be any number of issues, but I'd start by trying to hit the PACKAGES URL named in the error message (a) in your browser, and (b) via download.file in R.

Hey Jonathan

That makes sense now that its hanging when trying to check for packages. The PACKAGES url (a) works in my browser, and (b) download.file works in R but does not work in Rstudio (i.e., it hangs). In Rstudio, I tried download.file with wget and curl (instead of auto) and it still hangs. So it seems then that in Rstudio it's having trouble accessing the web, even though I can access it in R and on the machine.