New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RStudio setwd to mapped network drive not working Win10 #4030
Comments
|
@andzandz11 Thank you for raising this issue. We will review it as we work on development of RStudio. Would you be willing to try out the preview of the upcoming release to see if the problem is resolved? |
|
Some more info, as we have the same problem on our university network. I've noticed a striking difference in the environment variables used by RStudio compared to R itself. The culprit is the HOME environment variable as reported by //files/loginname/home in RStudio and \files\loginname\home in R itself. Our workaround is to use save as, go to "This PC" and expand, go the the actual drive (H: for example) and find the folder from there. That works. Using save as, then use the shortcut "Home" in the explorer and then browsing to the correct subfolder doesn't. This is using the latest version of RStudio (1.2.5001) and R 3.6.1 |
|
I have the same (or at least related) issue on my university network. The startup working directory is set to be the user's home drive mapped to |
|
Similar bug. My only solution has been after |
|
I believe these issues are resolved in the preview release of RStudio (v1.3). Would you be able to download that and give it a shot? |
|
Upgraded to version 1.3.944 (R version 3.6.1) and rebooted remote. Same issue unfortunately. |
|
@kevinushey can u pls check my new/additional comments back at #6598 (tested it with 1.3.947) |
|
I think @gtritchie commented in the other post -- sorry, I was incorrect that this is fixed in the current v1.3 preview release; our goal is to bring the fix as part of a later patch release. Sorry for the trouble. |
|
I found a way to trick R and RStudio into finding my network drive. Back story...the network drive was accessible through Windows Explorer but R could not see it. Even choose.dir() did not work. When I tried to map the network drive, it was already assigned. My solution...save a script on the network drive and open the script directly (double-click). It opened with no problem. Now, RStudio can find the drive, even after restarting my machine. |
|
@iwatanabe you basically are describing a variation of @cbrnr or @JoFAM comments and solutions for mapped networks on WIN |
|
I did try it in my R installation directly but choose.dir() did not show the drive. Even though I just installed them, I will check that the versions are the most recent with the appropriate patches. Thanks. |
|
I believe this is fixed in the latest v1.3 patch release (1.3.1056). https://rstudio.com/products/rstudio/download/#download If you're still seeing issues with that build of RStudio, please let us know and we'll re-open this issue. Thanks! |
|
I am using 1.3.1056 and the behavior persists. setwd fails on a network share (using mapped drive, not UNC), but it works if double-clicking on file (as described before on lwatanabe variation). |
|
Thanks. Are you able to confirm whether you see the same behavior with R launched within a Windows command prompt, or within RGui (R's bundled R GUI)? Or is this specific to RStudio? |
|
This error is persisting for me in Rstudio 1.3.1056. I can confirm that the problem is only in RStudio. When I run edit additional info: |
|
Re-opening this ticket based on the feedback from @chrisk-edu & @williamlief that it is still occurring in @kevinushey - milestone on this ticket is 1.4 and I'm not seeing a PR where it might have been fixed, am I missing something? |
|
I think I might've erroneously concluded that a previous fix for the handling of UNC paths would have fixed this issue as well. See: #6598 |
|
Leaving in 1.4 for now |
|
Hi, I had RStudio setup to always 'run as administrator' when I opened it from the taskbar, but when I open a project directly (by double clicking on it) it does not launch RStudio with administrator rights. I am running Windows 10 (version 18363.959). Happy to provide more details/info if that is helpful or try and test additional things. I've had this issue on R 4.0.0 and 4.0.2 and RStudio 1.3.1056. |
|
Thanks! This is useful. If the error reproduces in RGui, that likely implies the issue lies in R's own code, rather than something specific to RStudio. This limits our ability to solve the problem on the RStudio side, but if we're able to learn enough about what's going on we could attempt to supply a bug report + patch to the R Core team. |
No, this is not related to this bug. If you run as another user your environmental variables change including your mapped drives. That is intended behaviour under Windows and affects all programs. |
Thank you! For reference to others who find this thread in the future, running |
|
@andzandz11: The thing that confuses me most about this bug is that, in theory, there shouldn't be anything RStudio-related here -- R's This is the R implementation for If you're able, it might be worth trying to compile a helper C / C++ program that tries to accomplish the same task, with more diagnostics. For example: #include <Rcpp.h>
using namespace Rcpp;
#include <direct.h>
// [[Rcpp::export]]
void cd(std::string path) {
int status = _chdir(path.c_str());
if (status != 0) {
const char* fmt = "error changing working directory [errno=%i]\n";
Rprintf(fmt, errno);
}
}
/*** R
cd("Y:/")
*/I am not sure if there are any environment variables (or other application / system state) that could be influence the success or failure here, though. |
|
TLDR I don't think there is any difference between R and RStudio. The problem I was seeing was coming from windows user environmental variables per @andzandz11 . I had set RStudio to always open as an administrator when I opened it from the task bar, but NOT when I opened a project directly. This led me to believe that opening a project that existed on the network drive was somehow allowing RStudio to see the network drive. However, the actual problem was that I was running RStudio by default with the admin account (and the admin account doesn't have access to the network drive) but when I open a project directly RStudio launches only with regular user credentials and not as an admin. When I ran R gui, initially I did not run it as an administrator and it could access the network drive fine. I have checked and when I run R or RStudio as an Administrator they cannot see the network drive. When I run either as a regular user they both can access the network drive. Running |
|
Not sure if this still helps (but the issue is still open). This is not a bug in Windows, this is intended behaviour in Windows. As mentioned by @williamlief, running Rgui or Rstudio in admin mode runs a different set of environment variables / runs in a different context. A quick search on the web "why cmd prompt not show network drives in admin mode" yields many links amongst which:
This happens with most windows software that have an elevated start (the search indicates a cmd prompt as this was the easiest search to get to the link, but applies to R and Rstudio). Some users in this rstudio github issue report it from a university setting. If you have not downloaded and installed R and Rstudio yourself from the associated web pages (because you for example have not received admin or installation privileges from your university), you're most likely getting your R and Rstudio software packaged from the university. Most universities have a separate environment in which they offer packaged software to employees that can be installed, for example from something like a university "software center". These packaged software can be installed from a university link without admin rights required and have various settings pre-registered. If this is the case for you, you need to contact your own IT department to make them adjust these settings. Most likely they have set admin rights to the software to be able to install packages into the C-drive library. In my university we had many issues with the packaged university R and Rstudio versions, but were solved (by setting appropriate group policies and environment variables). Again, this should not be treated imo as an R or Rstudio bug. Hope this info helped. |
This works. Try it. |
What you are witnessing as "working" is (most of the time) "just" a "fix" of the connection to a mapped network drive getting established; |
issue has been reported in the past but without solution: https://support.rstudio.com/hc/en-us/community/posts/200652973-Network-Drives
has been reported here without solution:
https://stackoverflow.com/questions/25268582/rstudio-desktop-0-98-1006-for-windows-unable-to-access-mapped-network-drives
Version 1.1.453 – © 2009-2018 RStudio, Inc.
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/538.1 (KHTML, like Gecko) rstudio Safari/538.1 Qt/5.4.1
output from choose.dir()

same computer:

output from choose.dir()

The text was updated successfully, but these errors were encountered: