5

I'm running miniconda on Windows 10. I had installed rpy2 and used it in the past with no problems. Recently I upgraded from pandas version 0.24.0 to 0.25.1. After finding that broke a custom package that I've been working on I decided to drowngrade back to pandas version 0.24.0. After doing all that when I try to import robjects using the following:

import rpy2.robjects as ro

I get this error message:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-d790458a85bf> in <module>
----> 1 import rpy2.robjects as ro

C:\ProgramData\Miniconda3\lib\site-packages\rpy2\robjects\__init__.py in <module>
     12 import types
     13 import array
---> 14 import rpy2.rinterface as rinterface
     15 import rpy2.rlike.container as rlc
     16 

C:\ProgramData\Miniconda3\lib\site-packages\rpy2\rinterface.py in <module>
      4 import math
      5 import typing
----> 6 from rpy2.rinterface_lib import openrlib
      7 import rpy2.rinterface_lib._rinterface_capi as _rinterface
      8 import rpy2.rinterface_lib.embedded as embedded

C:\ProgramData\Miniconda3\lib\site-packages\rpy2\rinterface_lib\openrlib.py in <module>
     21 
     22 
---> 23 rlib = _dlopen_rlib(R_HOME)
     24 
     25 

C:\ProgramData\Miniconda3\lib\site-packages\rpy2\rinterface_lib\openrlib.py in _dlopen_rlib(r_home)
     16         raise ValueError('r_home is None. '
     17                          'Try python -m rpy2.situation')
---> 18     lib_path = rpy2.situation.get_rlib_path(r_home, platform.system())
     19     rlib = ffi.dlopen(lib_path)
     20     return rlib

C:\ProgramData\Miniconda3\lib\site-packages\rpy2\situation.py in get_rlib_path(r_home, system)
     70         lib_path = os.path.join(r_home, 'lib', 'libR.dylib')
     71     else:
---> 72         raise ValueError('The system "%s" is not supported.')
     73     return lib_path
     74 

ValueError: The system "%s" is not supported.
James Draper
  • 5,110
  • 5
  • 40
  • 59
  • It might be helpful to see your recent Conda transaction history (i.e., latest entries in `C:\ProgramData\Miniconda3\conda-meta\history` - or it might be in a user dir, not sure; but definitely `conda-meta\history`). – merv Sep 20 '19 at 16:14

2 Answers2

3

At the time of writing, rpy2 3.x isn’t supported on Windows.

If you want to use it, you need to install version 2.9.5 or wait until 3.x gained Windows support. If you need to use 3.x because some package depends on it, you’re out of luck and need to use e.g. a Linux VM.

flying sheep
  • 8,475
  • 5
  • 56
  • 73
2

This problem happened to me while I was trying to use rpy2 on a windows7. Make sure to follow this procedure if this is the case :

rpy2 install on windows 7

Also make sure you do this :

pip install tzlocal

Taha Mahjoubi
  • 372
  • 4
  • 10