Instructor: Jing Gong. Class Time: M/W/F 2:00-2:50 pm

Problems Installing Packages?

If you are unable to install packages in RStudio (such as a “not installed” or “cannot find dependency” error), some common solutions are outlined below:

Try a different CRAN mirror

It is possible your default CRAN Mirror is down or currently unavailable. You can switch to a different CRAN mirror from the RStudio Options Menu.

  1. In RStudio, go to Tools/Global Options…
  2. Click on Packages (on the left).
  3. Click on Change… under CRAN Mirror.
  4. Choose one of the USA sites at the end (i.e., try the one in CA1 or in Dallas, TX).
  5. Take a 5 minute break while the package is being installed.
  6. Rerun the script. It should work.
  7. If it does not work, re-do Steps 1~6 but choosing a different CRAN Mirror.
    If you tried several different CRAN Mirrors but it still gives an error, I recommend that you try the next approach.

Are you able to install packages in R?

If the above does not work, try to install packages in R (outside of RStudio) and see if you’re able to do that.

  1. Open R
  2. Copy the install.packages() function to R console. For example, if you are trying to install the psych package, copy the following code to R console: install.packages(“psych”)
  3. It will ask you to select a CRAN mirror. Choose one of the USA sites at the end (i.e., try the one in CA1 or in Dallas, TX).
  4. Take a 5 minute break while the package is being installed.
  5. Rerun the script. It should work.
  6. If it does not work, re-do Steps 1~5 but choosing a different CRAN Mirror.
    If you tried several different CRAN Mirrors but it still gives an error, I recommend that you try the next approach.

Are you able to connect to the Internet, or does your internet use a proxy?

If you’re not able to connect to the Internet via R, you may not be able to download and install packages. If your networking environment requires outbound network connections to go through a HTTP proxy, see the following Knowledge Base article on Configuring R to Use an HTTP Proxy

Try a different computer

If none of the above solutions work, use a different computer, for example, a lab computer.

I recommend you use the computer labs at Fox, which do have R/RStudio. Here is the list of computer labs and hours within Fox: http://www.fox.temple.edu/technology/it/resources/computer-labs/

NOTE that Tech Center is NOT recommended. The computers in the Tech Center may not have R/RStudio installed.

Leave a Reply