pythonpiprpy2

Failed building wheel for rpy2


I'm running Python v2.7.8 and R v3.0.2 (2013-09-25) -- "Frisbee Sailing" on my elementary OS Freya 64 bit (based on Ubuntu 14.04).

I'm trying to install the rpy2 package with:

pip install rpy2

and it fails with the error:

Failed building wheel for rpy2

Down below I also see:

error: command 'gcc' failed with exit status 1

The full output is here.

I've already tried:

sudo apt-get install python-dev libevent-dev python3-dev

but the error remains.

I know pip works because I've already installed numpy, matplotlib, scipy, and other packages using it.


Solution

  • Found the answer in this post. I just had to upgrade R from v3.0.2 to the latest version available for my system (v3.2.1).

    Step 1: Uninstall Previous R-base installation

    sudo apt-get remove r-base-core
    

    Step 2: Update Sources.List File

    1. Edit the sources.list file

      sudo gedit /etc/apt/sources.list
      
    2. Add following entry (for Ubuntu 14.04):

      deb http://cran.rstudio.com/bin/linux/ubuntu trusty/
      

    Step 3: Add the Public Keys

    gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
    gpg -a --export E084DAB9 | sudo apt-key add -
    

    Step 4: Install R-base

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install r-base
    

    Step5: install rpy2

    pip install rpy2