FAQ (Setup/installation problems for the "Scientific Computing in R" course)

FAQ (Setup/installation problems for the "Scientific Computing in R" course)

Problems related to access rights

Windows

  • I am not allowed to install R due to lack of admin rights
    • You may have to do a an additional work-around step to install in a different location than the default.
    • Pick "R for Windows" from the nearest download mirror: UmU | Pick different mirror
    • Choose the precompiled binary for the base distribution (the "install R for the first time" link)
    • Download the .exe file (R-4.0.0-win.exe) if you do not have administrator privileges.
    • Create a new folder named “R” under your user: C:/Users/<username>/R/.
    • Now install R normally in that folder: select C:/Users/<username>/R/ as the installation location, instead of the default C:/Program Files/.
  • RStudio will not run (and possibly complains that R is not installed/is not a compatible version)
    • Did you install R? You must first have installed R as described above. R must be version 2.11.1 or higher for RStudio to work with it.
  • I do not have permissions to install RStudio in the default location
    • During installation, you must select C:/Users/<username>/R/ as the installation location, instead of the default C:/Program Files/.
    • RStudio will create a folder named RStudio under C:/Users/<username>/R/.
    • If RStudio does NOT give you the option to choose an install location, then as a work-around you download the .exe file to somewhere you have access, then unzip the .exe file to a folder. You can now run RStudio from within the bin folder inside the folder that was created. 
      • Note, that if you are running RStudio this way, you most likely need to tell it where R is located. You do that under the menu point "Tools"->"Global options".
  • I am not allowed to install R packages
    • You need to configure the R libraries folder to use a different location than the default
      1. Create a folder in C:/Users/<username>/R/, named “R-Library.”
      2. Start the "R" program
      3. Run the following command to see what directory R works in when starting up
        1. path.expand("~").
      4. In the directory you get from the above command, create a new text file named .RProfile. (You can use the Notepad app for this, but make sure it does not append a ".txt” extension.)
      5. In the file .RProfile, you should put this content (remember to change to your user folder!)
        .First <- function() {
          path_to_libraries <- "C:/Users/<username>/R/R-Library" 
          .libPaths(c(path_to_libraries, .libPaths()))
        }
        

        R will automatically run the .First() function at the start of every R session, and the .libPaths() function call tells R to look first for your R-Library folder whenever it needs to install or access packages.

      6. If you have not already, close the R program. It needs to be restarted before you install packages.
      7. You can now install packages as normal.
    • I cannot install the package "lineprof"
      • Install Rtools separately first. It can be downloaded from here. If you do not have admin rights, remember to change the install location.
    • I get an error "Setting LC_CTYPE= failed"
      • You must set LC_CTYPE in a file, .Renviron, which you must first create. The easiest way to do this is the following:
        • Within R, type
          • user_renviron = path.expand(file.path("~", ".Renviron"))
            file.edit(user_renviron) # open with another text editor if this fails
            
          •  Add the text "LC_CTYPE=en_US.UTF-8" to the editor, then save with Ctrl-s. Use the name .Renviron for the file. 

Linux

  • I do not have root access. How do I install R?
    • In this case you will have to compile from source. 
    • Go to the nearest download mirror: UmU | Pick different mirror
    • Download the latest release (currently R-4.0.0.tar.gz) and uncompress to a directory where you have write access and then build according to the instructions in the INSTALL file included in the tarball.
    • Note that you do not need to 'make install', but can run from the directory.
    • NOTE if you do not have access to edit your .profile or other system initialization scripts, you can still start the R program, but you will need to use the full path (i.e. $HOME/local/R/R-4.0.0/bin/R) to start it.
  • I do not have root access. How do I install RStudio?
    • You need to install RStudio from source. Download, uncompress, and build according to included instructions. 
    • NOTE You need to configure the build with cmake, as appropriate. Some of the important flags to set are
      cmake .. -DRSTUDIO_TARGET=Desktop -DCMAKE_BUILD_TYPE=Release CMAKE_INSTALL_PREFIX=/your/choosen/dir
      make install
  • I am getting a permission error when trying to install packages
    • If you do not have root access, you need to create a directory for your R packages and set the variable R_LIBS to the path to that library before installing packages. I.e. for a directory in $HOME/local/rpacks it would be: 
      • c-shell: setenv R_LIBS $HOME/local/rpacks
      • bash: export R_LIBS=$HOME/local/rpacks
Updated: 2021-07-20, 15:13