I was using my own laptop to install R and I found that it only has one library. Evne though this library is still read only, everytime when I use Rstudio: install.packages("abc"), I can see that the new packages are stored automatically into that read only library folder.
In my office's desktop, I "believe" I also have administrator role, as I can install and remove anything (by far). I download the latest version of R and I right click the R-3.4.1-win.exe, there is an item "run as administrator", then it is installed in my desktop. However, when I use R studio to install new packages as in my laptop, it always automatically create a personal folder to store the new packages. I don't know why. Is that a way to only have one folder for library? I also tried on the desktop in the plain R mode (without using Rstudio). When I want to install new packages, it always says
Warning in install.packages("devtools") :
'lib = "C:/Program Files/R/R-3.4.1/library"' is not writable
And there is a window pops up to ask me "would you like to create a personal folder?" And if I say no, then
Error in install.packages("devtools") : unable to install packages.
Is there a ways to solve this problem? To just maintain one folder for library
What version of Windows are you using? You should be able to right-click on the Rstudio.exe icon, click Properties, and select an option to always run Rstudio as administrator. Be sure you use that same icon whenever you want to open Rstudio.
Incase of Mac, go to Applications, then right click on RStudio and
Select "Show Package Contents"
Go to Contents/MacOS
Now open terminal(in bash mode). Type sudo and drag the RStudio.exec into terminal and press on ENTER
Now RStudio will have admin access!
For completeness, I think there should be an Ubuntu answer to go along with the Microsoft and Apple answers. (Note:I'm using 18.06, and not 20.x.)
What doesn't work:
On my Ubuntu/Linux system, when Rstudio is installed the call start RStudio from a terminal looks something like the following:
(base) username#sysname:~$ rstudio
It starts, but has the permissions of the user, and can have access errors.
What gives admin power:
To give it better permissions, you can use sudo.
(base) username#sysname:~$ sudo rstudio
[sudo] password for username: <enter password here>
It starts in a different user location, but has more power. After it is installed you can run it the regular way and the packages are still installed.
Extra credit:
Here are some (currently) relevant links for RStudio on Ubuntu:
https://linuxhint.com/rstudio-for-ubuntu/
https://www.r-bloggers.com/2013/03/download-and-install-r-in-ubuntu/
What is the command to invoke RStudio from Command Line in linux environment?
http://web.cs.ucla.edu/~gulzar/rstudio/index.html
Related
I'm trying to update packages on RGui (64-bit) using update.packages but I'm getting the following message:
Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, :
'lib = "C:/PROGRA~1/R/R-212~1.1/library"' is not writable
Error in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, :
unable to install packages
I've looked at the library folder in Explorer and it has read only set, so I removed it. However, it reappears when I check the properties again immediately after doing this. Installing new packages is unaffected since they have a separate folder in my user profile.
Is there a trick to getting this to work?
It happens the same to me, and after coding hours and hours in "R" of Gui Project, i got bored because it is much easier to read a code when the interface uses colours for a certain type of words (commands). Well, i decided to install RStudio, but soon i was faced with package installation problems. It seems that happens in Windows 7. The way that I used to solve this problem with RSutido was:
C:\Program Files\R - and this is the folder that contains "R" and not RStudio folder!
Right click for properties.
Security.
In "Group or user names" select your name
click "Edit"
select "Full control"
Apply and click OK
After this steps you should be ok to install all the packages :-)
Usually you need administrator rights to change things in program files. Try running RGui as administrator.
try
install.packages('package_name', lib='folder')
you can specify a folder for installation of the libraries, for which you have writing permission.
Hope this helps
Uninstalling from C:\Program Files and re-installing to C:\R worked for me
[See mdsumner's comment and Windows FAQ found here]
"...Users of Vista/Windows 7/8/Server 2008/2012 installing for a single user using an account with administrator rights1 should consider installing into a non-system area (such as C:\R)"
I had this exact problem and just changed it for myself. That is I navigated to C:/PROGRAM/R and then right clicked on the R to bring up properties. Went to the Security tab clicked on the Group/User that you want to add permissions for. That for me was USER then clicked EDIT and then selected the boxes that were unchecked to Allow control over. I had to do this specifically for each user (of course I was running the entire time as administrator). Clicked Apply/OK and all is well. I can now update/install/ new libraries and what have you for this computer without having to run R as the admin.
Without more information, my first guess is that you have insufficient permissions to write to the R site library folder. Usually, R would prompt for creation of a user lib folder to install to, but this can be unreliable under Windows Vista/Windows 7.
Try:
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
In the R console. Libraries should now install to /Users/"you"/R/win-library/x.y, for which you have the appropriate permissions.
I have BitDefender 2018 and had to disable "safe files" and "firewall".
I had a similar error recently. Running RStudio as an administrator didn't work. And changing the permissions on C:/Programs/R is a bit clumsy, as you'd have to repeat it for every user.
The solution for me was changing the library path for R as follows
In the R console, type .libPaths(). You'll see something like this,
"Path/to/user/R/win-library/x.x" "C:/Programs/R/R-x.x.x"
The two paths exist because you have defined a user-specific lib path during installation. Replace x.x.x with your R version.
Now set the lib path to the Programs directory
.libPaths = "C:/Programs/R/R-x.x.x"
Now you can install.packages() or update.packages()!
Try choosing a cranmirror location closer to you with this command first
chooseCRANmirror()
And then try installing the package. This command worked for me when I was getting warnings on installing "devtools".
I also had this kind of problem in Windows 10, Then I disable "Safe Files" in Bitdefender 2018. It works for me
Sometimes there may also be a possibility that your Antivirus is blocking the application. Unblock the application if anti virus has blocked it.
I installed a new version of R but rstudio still uses the old version. The command "which R" is just a shell script and I'm not sure how to get rstudio and the new version of R integrated. R base installed in /usr/share/doc.
Any tips?
Thanks,
Bob
See the RStudio support pages. In particular, for Linux, you have to set the RSTUDIO_WHICH_R environment variable.
As found out in the comments, you're on a Linux system, specifically Linux Mint 17. I can see three basic scenarios here:
You want to ensure RStudio uses a specific version of R when you are launching RStudio from the terminal as a one-time event.
You want to ensure RStudio uses a specific version of R every time you launch RStudio from the terminal.
You want RStudio to use a specific version of R when you launch RStudio from the applications menu (or, equivalently, via something like Synapse).
They are dealt with in turn below. I assume throughout that the path to the R binary you want RStudio to use is /opt/R/3.1.0/bin/R, which you should change as appropriate.
One-time Terminal Launch
After opening a terminal via Ctrl-Alt-T, run
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then, anytime you launch RStudio from the terminal via the rstudio command in that terminal session, it will use the specified R version. However, after you exit, the next time you open the terminal, it will no longer respect that choice.
Every Terminal Launch
Use your favorite text editor to edit the file ~/.bashrc. At the end, on a new line, add
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then, either launch the terminal, or if you already have it open run the command source .bashrc. Then, you can launch RStudio via the command rstudio and it will use the version of R you want.
Launching from the Applications Menu
Use your favorite text editor to edit the file ~/.profile. At the end, on a new line, add
export RSTUDIO_WHICH_R=/opt/R/3.1.0/bin/R
Then you need to log out of your system and log back in. After that, anytime you launch RStudio from the application menu, it will use the specified R version.
I have just installed the latest versions of R (3.1.0) and Rstudio (v0.98.507) on a Windows 7 machine, 64 bit.
The R GUI works OK, but when I open the RStudio.exe only a blank window opens. I've tried re-installing R and RStudio.
Any suggestions?
By choosing the R version I wanted to use I was able to use Rstudio again.
To choose the R version you want to use with Rstudio do the following;
Click the CTRL key (don't let go)
Click on the Rstudio icon
Choose the version you want in the pop-up window.
For Ubuntu users where #neal's solution doesn't work.
$ rstudio --no-sandbox
related to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1944468
Download the 64bit version and reinstall it.
The same for Linux
FOR LINUX: this happens to me on cloud instances. A solution is forcing software rendering of RStudio. You need to start RStudio, get to the black screen, close Rstudio black screen, do my solution below in the terminal with Rstudio closed, then start Rstudio again.
In terminal:
sudo nano ~/.config/RStudio/desktop.ini
APPEND THE FOLLWING TO [General] section (leave whatever is there and add the line below):
[General]
desktop.renderingEngine=software
Again this is for Linux, but there may be a similar issue in Windows and you may be able to force software rendering.
Press down Ctrl key and then click on RStudio icon to launch. A dialog box asks you about the R version. Choose the one that actually exists (you might see an R version which does not exist; confusing RStudio)
For Windows10 64bit.
After following the hold Ctrl and clicking RStudio icon.
Change the Rendering Engine: to Software.
This fixed the problem on my machine.
I'm trying to get R to recognize that I have installed Rtools.exe. I've tried installing it in several different locations. However, whenever I restart R and load devtools I get the same error:
> library(devtools)
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.0 from http://cran.r-project.org/bin/windows
/Rtools/ and then run find_rtools().
Naturally, whenever I try the function find_rtools() I get the same error message. I'm done trying to figure this out with help files, as the devtools help doesn't offer much. I've tried installing in several of the locations returned by get_path() but the problem persists.
FYI, currently my R is installed at D:/R.
Has anyone else had this problem, and more importantly, can anyone help me?
I'm sorry if this is a duplicate, and I've tried to include as many relevant details as possible so if you need any clarification please let me know.
Thanks,
Nick
Grab the batch file Rpathset.bat from batchfiles, edit the SET statements in it appropriately and then run R like this from the Windows console:
Rpathset
Rgui
I ran into this issue running a Windows 7 machine without admin rights. I leveraged G. Grothendieck's response, with a few additional steps.
Get Rpathset.bat from https://code.google.com/p/batchfiles/
Edit the Set statements in Rpathset.bat to your paths
Run CMD and change directories to where Rpathset.bat is stored
In the command prompt, run rpathset.bat > mypath.txt
Open mypath.txt with a text editor
Click Windows Start and search for environment
Click Edit environment variables for your account
Click path and then edit
Copy and paste the entire path from mypath.txt into the Windows path (everything after the path statement)
Restart RStudio and check that devtools::find_rtools() is TRUE
This file rtools.r contains the code for find_rtools(). It looks like it is trying to find ls and gcc in your system path (and then does some more checks based on the version) and if that fails it tries to look up SOFTWARE\R-core\Rtools in the the Windows registry.
As Thomas mentioned here, "Rtools is not a package." This is what I did to install Rtools. My RStudio is running R version 3.1.3. So I downloaded Rtools31.exe from https://cran.r-project.org/bin/windows/Rtools/. I executed the exe file, selected all the default options in the Setup Wizard and installed. (I had admin privilege on the computer I was using but I am not sure if that makes any difference.) To check that it was properly installed, you can enter find_rtools() in the R prompt which should return TRUE if Rtools installed properly.
For R 3.0, you probably just need to download Rtools30.exe and follow the same steps above.
I ran into this problem trying to install Rtools33 to use Hadley Wickham's lineprof package. I got that error multiple times. I'm running Windows 7 on a laptop.
I was able to fix the problem by running the Rtools installation file as the windows Admin (i.e. right-click the Rtools33.exe and choose "Run as administrator")
I also made sure to point the path to the R source directory, which I kept in C:\Rtools\ (which contains C:\Rtools\bin\ and C:\Rtools\gcc-4.6.3\).
This solved the problem for me and I am now able to install lineprof from GitHub and make use of it.
I'm trying to update packages on RGui (64-bit) using update.packages but I'm getting the following message:
Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, :
'lib = "C:/PROGRA~1/R/R-212~1.1/library"' is not writable
Error in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, :
unable to install packages
I've looked at the library folder in Explorer and it has read only set, so I removed it. However, it reappears when I check the properties again immediately after doing this. Installing new packages is unaffected since they have a separate folder in my user profile.
Is there a trick to getting this to work?
It happens the same to me, and after coding hours and hours in "R" of Gui Project, i got bored because it is much easier to read a code when the interface uses colours for a certain type of words (commands). Well, i decided to install RStudio, but soon i was faced with package installation problems. It seems that happens in Windows 7. The way that I used to solve this problem with RSutido was:
C:\Program Files\R - and this is the folder that contains "R" and not RStudio folder!
Right click for properties.
Security.
In "Group or user names" select your name
click "Edit"
select "Full control"
Apply and click OK
After this steps you should be ok to install all the packages :-)
Usually you need administrator rights to change things in program files. Try running RGui as administrator.
try
install.packages('package_name', lib='folder')
you can specify a folder for installation of the libraries, for which you have writing permission.
Hope this helps
Uninstalling from C:\Program Files and re-installing to C:\R worked for me
[See mdsumner's comment and Windows FAQ found here]
"...Users of Vista/Windows 7/8/Server 2008/2012 installing for a single user using an account with administrator rights1 should consider installing into a non-system area (such as C:\R)"
I had this exact problem and just changed it for myself. That is I navigated to C:/PROGRAM/R and then right clicked on the R to bring up properties. Went to the Security tab clicked on the Group/User that you want to add permissions for. That for me was USER then clicked EDIT and then selected the boxes that were unchecked to Allow control over. I had to do this specifically for each user (of course I was running the entire time as administrator). Clicked Apply/OK and all is well. I can now update/install/ new libraries and what have you for this computer without having to run R as the admin.
Without more information, my first guess is that you have insufficient permissions to write to the R site library folder. Usually, R would prompt for creation of a user lib folder to install to, but this can be unreliable under Windows Vista/Windows 7.
Try:
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
In the R console. Libraries should now install to /Users/"you"/R/win-library/x.y, for which you have the appropriate permissions.
I have BitDefender 2018 and had to disable "safe files" and "firewall".
I had a similar error recently. Running RStudio as an administrator didn't work. And changing the permissions on C:/Programs/R is a bit clumsy, as you'd have to repeat it for every user.
The solution for me was changing the library path for R as follows
In the R console, type .libPaths(). You'll see something like this,
"Path/to/user/R/win-library/x.x" "C:/Programs/R/R-x.x.x"
The two paths exist because you have defined a user-specific lib path during installation. Replace x.x.x with your R version.
Now set the lib path to the Programs directory
.libPaths = "C:/Programs/R/R-x.x.x"
Now you can install.packages() or update.packages()!
Try choosing a cranmirror location closer to you with this command first
chooseCRANmirror()
And then try installing the package. This command worked for me when I was getting warnings on installing "devtools".
I also had this kind of problem in Windows 10, Then I disable "Safe Files" in Bitdefender 2018. It works for me
Sometimes there may also be a possibility that your Antivirus is blocking the application. Unblock the application if anti virus has blocked it.