0

On my windows 10, Like Jupyter OSError 0x7e when loading rpy2 error.

I'l show rpy2.situation as follows.

rpy2 version: 3.3.5 Python version: 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] Looking for R's HOME: Environment variable R_HOME: None InstallPath in the registry: C:\Program Files\Microsoft\ML Server\R_SERVER
Environment variable R_USER: None Environment variable R_LIBS_USER: None R version: In the PATH: None Loading R library from rpy2: cannot load library 'C:\Program Files\Microsoft\ML Server\R_SERVER\bin\x64\R.dll': error 0x7e Additional directories to load R packages from: None C extension compilation: include: ['C:/PROGRA~1/MIE74D~1/MLSERV~1/R_SERVER/include', 'C:/PROGRA~1/MIE74D~1/MLSERV~1/R_SERVER/include/x64'] libraries: ['R', 'm'] library_dirs: ['C:/PROGRA~1/MIE74D~1/MLSERV~1/R_SERVER/bin/x64'] extra_compile_args: [] extra_link_args: []

  • Could you clarify what have you tried and what is the issue? The question is not well written, I recommend you to read [how-to-ask](https://stackoverflow.com/help/how-to-ask) section and formulate and format your question in better manner. – Nerxis Jul 10 '20 at 07:09
  • 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:26

1 Answers1

0

Here is my working solution:

import os
os.environ["R_HOME"] = r"D:\Install\R\R-3.6.1"
os.environ["PATH"]   = r"D:\Install\R\R-3.6.1\bin\x64" + ";" + os.environ["PATH"]
import rpy2
from rpy2.robjects import pandas2ri, packages
pandas2ri.activate()
stats = packages.importr('stats')
Bruno Gabuzomeu
  • 1,061
  • 8
  • 9