3

I'm trying to run a function contained within an R script from Python. I've installed rpy2 but my script is failing on the first line:

import rpy2.robjects as robjects

With this error:

Exception has occurred: OSError
cannot load library 'C:\Program Files\R\R-3.6.3\bin\x64\R.dll': error 0x7e

I've searched and I can't find exactly the same error coming up anywhere else. However, I did try a couple of other fixes neither of which worked:

  1. Adding C:\Program Files\R\R-3.6.3\bin\x64 to my path
  2. Running os.environ['R_HOME'] = 'C:\Program Files\R\R-3.6.3' at the very start of my script
Jossy
  • 589
  • 2
  • 12
  • 36
  • Have you added R_USER to your System Variables? – Nypar Jul 15 '20 at 08:17
  • Yep. Followed the guidance here - https://stackoverflow.com/a/25479841/11277108. Also tried adding ```R_USER``` to User variables as per the comments – Jossy Jul 15 '20 at 12:43
  • 3
    Does this answer your question? [OSError: cannot load library 'C:\Program Files\R\R-4.0.2\bin\x64\R.dll': error 0x7e](https://stackoverflow.com/questions/63863449/oserror-cannot-load-library-c-program-files-r-r-4-0-2-bin-x64-r-dll-error-0) – Bruno Gabuzomeu Sep 25 '20 at 07:29

0 Answers0