title: rpy2 import is not working
body: <p>I get an error when I try to import rpy2. Here is the code and error. </p>
  
  <pre><code>&gt;&gt;&gt; import pandas.rpy.common
  Traceback (most recent call last):  
  
  File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\IPython\core\interactiveshell.py", line 2828, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
  
  File "&lt;ipython-input-148-c258a0f70d44&gt;", line 1, in &lt;module&gt;
  import pandas.rpy.common
  
  File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\pandas\rpy\common.py", line 14, in &lt;module&gt;
  from rpy2.robjects.packages import importr
  
  ImportError: No module named 'rpy2'
  </code></pre>
  
  <p>What could be the issue? I'm using python version 3.3.3 and pandas version 0.13.1</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Tried to install rpy2 separately. </p>
  
  <ol>
  <li><p>Directly using <code>python setup.py install</code> gave me an error that <code>os</code> doesn't have a module <code>popen3</code>. </p></li>
  <li><p>Directly installing the exe (rpy2-2.3.9.win32-py3.3.exe) from Christoph Gohlke's site <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/" rel="noreferrer">http://www.lfd.uci.edu/~gohlke/pythonlibs/</a> run fine. But if I try to do <code>import pandas.rpy.common as com</code> then I get the following error (issue with the loading the DLL at <code>from rpy2.rinterface._rinterface import *</code> :</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\IPython\core\interactiveshell.py", line 2828, in run_code
  exec(code_obj, self.user_global_ns, self.user_ns)
  
    File "&lt;ipython-input-10-63ebebefea80&gt;", line 1, in &lt;module&gt;
  import pandas.rpy.common as com
  
    File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-    packages\pandas\rpy\common.py", line 14, in &lt;module&gt;
  
  from rpy2.robjects.packages import importr
  
    File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\rpy2\robjects\__init__.py", line 15, in &lt;module&gt;
  
      import rpy2.rinterface as rinterface
    File "C:\PF\WinPython-64bit-3.3.3.3\python-3.3.3.amd64\lib\site-packages\rpy2\rinterface\__init__.py", line 103, in &lt;module&gt;
  
      from rpy2.rinterface._rinterface import *
  ImportError: DLL load failed: %1 is not a valid Win32 application.
  </code></pre></li>
  </ol>
  
  <p><strong>EDIT</strong></p>
  
  <p>Solved it finally. It seems like adding R_HOME and R_USER environment variables did the trick. </p>