Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

%load_ext rpy2.ipython Image not found error

Tags:

rpy2

I am trying to use the magic command in ipython, something I saw here: rpy2 slides

I have done the following:

import rpy2.ipython
%load_ext rpy2.ipython

But I get the following error:

ImportError: dlopen(/Users/XXX/anaconda/lib/python2.7/site-packages/rpy2/rinterface/_rinterface.so,

2): Library not loaded: libicuuc.54.dylib Referenced from: /Users/XXX/anaconda/lib/python2.7/site-packages/rpy2/rinterface/_rinterface.so Reason: image not found

Some relevant information:

  • OS: MacOS Sierra
  • Python: 2.7.12
  • iPython: IPython 5.1.0
  • rpy2: 2.8.3
  • Did the pip install singledispatch but the error still persists
  • r installed using conda
  • Also have a copy of R from CRAN
like image 575
Rohit Avatar asked Aug 30 '25 18:08

Rohit


1 Answers

Because I installed R through conda, I also needed to install rpy2 through conda and not through pip. To install rpy2 through conda do the following,

conda install -c r rpy2

This worked really well. However, it is unclear why installing rpy2 through pip does not work.

like image 121
Rohit Avatar answered Sep 04 '25 00:09

Rohit