Rpy2 Error Wac-A-Mole: R_User Not Defined

Rpy2 error wac-a-mole: R_USER not defined

You need to set the R_USER environment variable, e.g. to the username of the Windows account you use. See also this quote from this link:

1) Add the path to R.dll to my PATH variable (I went to the 32-bit directory) 2) Add an environment variable R_HOME (C:\Program Files\R\R-2.12.1 for me) 3) Add an environment variable R_USER (simply my username in Windows).

How to set environment variable R_User? And how to get module winreg?

It seems that you have to tweek your environment variables manually. To do this, go to the environment variables (Control Panel > System Settings > Advanced System Settings > (Advanced Tab) Environment Variables) and follow the steps from the top answer here: How to setup environment variable R_user to use rpy2 in python . (Make sure you add to the Path).

Concerning the RRuntimeError you mentioned in the comments, it's hard to tell without further info, but it seems like your code tries to open a file (or install R libraries). Check out these links:

  • Error in file(file, "rt") : cannot open the connection
  • assign variables from python to R using r.assign and then use read.table
  • https://bitbucket.org/rpy2/rpy2/issues/399/rruntimeerror-error-in-file-file-rt-cannot

Error install rpy2: 'sh' is not recognized as an internal or external command, operable program or batch file

  1. Download the version you need here http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
  2. Open Anaconda Prompt and navigate to the folder you have downloaded the file
  3. Run pip install file_name.whl


Related Topics



Leave a reply



Submit