title: Installing rpy2 to work with R 3.4.0 on OSX
body: <p>I would like to use some R packages requiring R version 3.4 and above. I want to access these packages in python (3.6.1) through rpy2 (2.8).</p>
  
  <p>I have R version 3.4 installed, and it is located in <code>/Library/Frameworks/R.framework/Resources</code> However, when I use <code>pip3 install rpy2</code> to install and use the python 3.6.1 in <code>/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6)</code> as my interpreter, I get the error:</p>
  
  <blockquote>
    <p>Traceback (most recent call last):
      File "/Users/vincentliu/PycharmProjects/magic/rpy2tester.py", line 1, in 
        from rpy2 import robjects
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/robjects/<strong>init</strong>.py", line 16, in 
        import rpy2.rinterface as rinterface
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/<strong>init</strong>.py", line 92, in 
        from rpy2.rinterface._rinterface import (baseenv,
    ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/_rinterface.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libiconv.2.dylib
      Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rpy2/rinterface/_rinterface.cpython-36m-darwin.so
      Reason: Incompatible library version: _rinterface.cpython-36m-darwin.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0</p>
  </blockquote>
  
  <p>Which first seemed like a problem caused by Anaconda, and so I remove all Anaconda-related files but the problem persists.</p>
  
  <p>I then uninstalled rpy2, reinstalled Anaconda and used <code>conda install rpy2</code> to install, which also installs R version 3.3.2 through Anaconda. I can then change the interpreter to <code>/anaconda/bin/python</code> and can use rpy2 fine, but I couldn't use the R packages I care about because they need R version 3.4 and higher. Apparently, the oldest version Anaconda can install is 3.3.2, so is there any way I can use rpy2 with R version 3.4?</p>
  
  <p>I can see two general solutions to this problem. One is to install rpy2 through conda and then somehow change its depending R to the 3.4 one in the system. Another solution is to resolve the error</p>
  
  <blockquote>
    <p>Incompatible library version: _rinterface.cpython-36m-darwin.so requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0</p>
  </blockquote>
  
  <p>After much struggling, I've found no good result with either.</p>