0

So i use anaconda for all this, the problem is when i try to do:

r = pyper.R(RCMD="D:/Apps/Anaconda/envs/rstudio/lib/R",use_pandas='True')

but then the error apear :


PermissionError                           Traceback (most recent call last)
<ipython-input-28-31688287b0f4> in <module>
----> 1 runningR("Dataset/ml-latest-small/ratings.csv")

<ipython-input-27-0e85c3dea21c> in runningR(fileName)
      2 
      3     #Rのインスタンスを作る
----> 4     r = pyper.R(RCMD="D:/Apps/Anaconda/envs/rstudio/lib/R",use_pandas='True')
      5 
      6     #r.assign("fileName", fileName) #fileNameとし引数のfileNameを渡す

D:\Apps\Anaconda\lib\site-packages\pyper.py in __init__(self, RCMD, max_len, use_numpy, use_pandas, use_dict, host, user, ssh, return_err, dump_stdout)
    598                 childstderr = file('nul', 'a')
    599 
--> 600         self.__dict__['prog'] = Popen(RCMD, stdin=PIPE, stdout=PIPE, stderr=return_err and _STDOUT or childstderr, startupinfo=info)
    601         self.__call__(self.Rfun)
    602 

D:\Apps\Anaconda\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
    767                                 c2pread, c2pwrite,
    768                                 errread, errwrite,
--> 769                                 restore_signals, start_new_session)
    770         except:
    771             # Cleanup if the child failed starting.

D:\Apps\Anaconda\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
   1170                                          env,
   1171                                          os.fspath(cwd) if cwd is not None else None,
-> 1172                                          startupinfo)
   1173             finally:
   1174                 # Child is launched. Close the parent's copy of those pipe

PermissionError: [WinError 5] Access is denied
  • `CreateProcessW` fails with `ERROR_ACCESS_DENIED` (5) if the executable file doesn't grant execute access (rare in Windows, especially on personal systems) or if you try to execute a directory. My guess would be that "D:/Apps/Anaconda/envs/rstudio/lib/R" is a directory. – Eryk Sun Apr 12 '19 at 10:18
  • Ok this really works, thanks! and the executable is in "\Scripts\R.exe" according to this : https://github.com/ContinuumIO/anaconda-issues/issues/777 – ALDY NOAH Apr 13 '19 at 06:14

1 Answers1

0

It seems that R is requiring administrator privileges to be accessed. However you're launching your environment (IDE/Anaconda), right click and 'Run as administrator'.

Maher Said
  • 161
  • 2
  • 12
  • No, if a program requires administrator access, and the caller isn't elevated, `CreateProcessW` fails with `ERROR_ELEVATION_REQUIRED` (740). – Eryk Sun Apr 12 '19 at 10:20
  • Oh okay. My response was based on the WinError 5, which is also in line with the response here: https://stackoverflow.com/a/27801762/3443106 . – Maher Said Apr 13 '19 at 00:22
  • That's almost always not the case. Standard users have read and execute access to files installed in normal places. If you read the comments on the question itself, you'll see it was resolved by specifying the full path of the executable instead of its directory, i.e. the poster was trying to execute a directory via `CreateProcessW`. The 28 upvotes on that answer are a common problem with Stack Overflow. An upvote doesn't mean the votes are informed by reading documentation, debugging, and experiments, or that the voters have even a passing familiarity with the underlying API calls. – Eryk Sun Apr 13 '19 at 03:20