Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot import rpy2.robjects after updating pandas "ValueError: The system "%s" is not supported."

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.
like image 446
James Draper Avatar asked Sep 20 '19 15:09

James Draper


1 Answers

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.

like image 52
flying sheep Avatar answered Sep 29 '22 22:09

flying sheep