Error importing rpy2.robject. Library not loaded: @rpath/libicuuc.54.dylib

Issue #402 closed
Yingkai Sha
created an issue


When I was trying to import rpy2.robjects, I got the error like this:

In [1]: import rpy2.robject as robj
ImportError                               Traceback (most recent call last)
<ipython-input-1-ebf86d4bdeb3> in <module>()
----> 1 import rpy2.robject as robj

ImportError: No module named robject

In [2]: import rpy2.robjects as robj
ImportError                               Traceback (most recent call last)
<ipython-input-2-bd5d7cf0a3b1> in <module>()
----> 1 import rpy2.robjects as robj

/Users/yingkai/anaconda2/lib/python2.7/site-packages/rpy2/robjects/ in <module>()
     14 import itertools
     15 from datetime import datetime
---> 16 import rpy2.rinterface as rinterface
     17 import rpy2.rlike.container as rlc

/Users/yingkai/anaconda2/lib/python2.7/site-packages/rpy2/rinterface/ in <module>()
     90 del(os)
---> 92 from rpy2.rinterface._rinterface import (baseenv,
     93                                          emptyenv,
     94                                          endr,

ImportError: dlopen(/Users/yingkai/anaconda2/lib/python2.7/site-packages/rpy2/rinterface/, 2): Library not loaded: @rpath/libicuuc.54.dylib
  Referenced from: /Users/yingkai/anaconda2/lib/python2.7/site-packages/rpy2/rinterface/
  Reason: image not found

I have R version 3.3.2_0; rpy2 version 2.8.5. python version 2.7.x. Both R and rpy2 were installed from Anaconda2 (conda -c r).

I can see a libicuuc.dylib in /opt/local/lib but not in /Users/$myname/anaconda2/lib/R/lib. Not sure if I should manuelly build a link. Does anyone know how to fix the problem ?

Thanks, Yingkai

Comments (5)

  1. Yingkai Sha reporter

    Hi all,

    Just a follow up, recently when I was updating all the anaconda packages, this update fixed the problem

    rpy2: 2.8.5-py27r3.3.2_2 r --> 2.8.5-py27r3.3.2_0 conda-forge

    I think it was more like a conda issue. Thanks for the help.

  2. Log in to comment