Get Permission denied Errors When Installing Packages in RStudio

I installed R 4.1.3 and RStudio-Server 2.22.12.0 on a Linux (RHEL 8.7) server. I am able to access RStudio without any problems, however, I am getting the following errors when trying to install some packages. Note, I was able to download and install other packages so it's not that everything failed to install. The rstudio_tester user's home directory is fully accessible. I tried assigning all the permissions (777) to it but still getting the same errors. I am new to Linux and to RStudio. Please help. Thank you.

Below is an example.
install.packages("formattable")

I'm no expert but looking at the Installation manual I think the /tmp directory on your system is not executable. Try making a /tmp directory in your home directory and then setting the TMPDIR environment variable of R to that directory. To set the variable, use Sys.setenv()

Sys.setenv(TMPDIR="/path/to/your/new/tmp")
1 Like

Can you post the complete console output you get as formatted text? (screenshots are considered a bad practice here).

Here is how to do it :

Can you show the permissions for your package library?

ls - lah <<path to your package library >>

This has resolved my issue. Thank you! I made a tmp directory in my home directory and then set the TMPDIR environment variable of R to that directory. After that, I was able to install the packages that failed to install. Now, I am trying to set up a new default package installation library so any new packages will be installed to that directory instead of the home one which there isn't much storage. I am assuming the tmp folder and the TMPDIR can also be pointing to another directory that's outside of the home one.

This topic was automatically closed 7 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.