13

I am trying to load rpy2 inside a project where I am working with anaconda and I am getting a surprising error for which I cannot find a solution. My python version is 3.4, my anaconda version is 3.17.0 - I am using a Mac (OSX Yosemite version 10.10.4)

R version 3.2.2 (2015-08-14) -- "Fire Safety"

Platform: x86_64-apple-darwin11.4.2 (64-bit)

try:
    from rpy2 import robjects
except ImportError as e:
    print(e)

I am getting this error message

dlopen(/Users/user1/anaconda/lib/python3.4/site-packages/rpy2/rinterface/_rinterface.so, 2): Library not loaded: @rpath/R/lib/libR.dylib Referenced from:

/Users/user1/anaconda/lib/python3.4/site-packages/rpy2/rinterface/_rinterface.so Reason: image not found

Thanks in advance for your help

Community
  • 1
  • 1
Michael
  • 2,436
  • 1
  • 36
  • 57

1 Answers1

16

I just built an updated rpy2 2.7.0 against R 3.2.2. Can you run

conda install -c r rpy2 

and see if that fixes it?

asmeurer
  • 86,894
  • 26
  • 169
  • 240
  • @asmeurer -- I have the exact same issue and installing rpy2 as you outlined doesn't fix it. I just upgraded to Mac OSX 10.11, my Python version is 'Python 2.7.10', conda: '3.18.4', R: 'R version 3.2.2 (2015-08-14) -- "Fire Safety"' -- I have updated all conda packages, installed r-essentials, and everything else I can imagine – Clayton Nov 12 '15 at 07:35
  • I created a new question as I think this might be a more complex issue: http://stackoverflow.com/questions/33672565/rpy2-error-after-upgrading-to-osx-el-capitan – Clayton Nov 12 '15 at 13:30
  • 1
    installing with conda i got https://gist.github.com/88bf9ed4f9234a2c88ea that seems related to rpy2 version (bug fixed in 2.7.4, conda seems to install 2.7.0): https://bitbucket.org/rpy2/rpy2/issues/313/typeerror-type-rpy2rinterfacestrsexpvector – epifanio Jan 19 '16 at 19:15
  • Thank you @asmeurer! You saved me a lot of time – Luis Miguel Sep 17 '16 at 19:30
  • Do you have any suggestions for using rpy2 with an r-conda environment? http://stackoverflow.com/questions/42126077/use-rpy2-with-packages-installed-in-r-conda-environment – O.rka Feb 09 '17 at 20:23