How do I solve 'cannot load library error' with rpy2?

Viewed 244

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
0 Answers
Related