Gabriel
Gabriel

Reputation: 42329

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.

Upvotes: 5

Views: 9306

Answers (6)

Dimuth
Dimuth

Reputation: 752

First upgrade the pip version

pip install --upgrade pip

Then install system dependencies (Ubuntu)

sudo apt-get install -y libssl-dev libffi-dev libxml2-dev libxslt1-dev libopenblas-dev

Then try to install again

pip install rpy2

Upvotes: 0

Stopfield
Stopfield

Reputation: 43

For people wondering, in Fedora, you need to install this package:

sudo dnf install python3-devel

This will solve the problem if you have a header issue! Pip is trying to compile rpy2, thus it needs a header file. The header file is within this package!

Upvotes: 1

Stefan
Stefan

Reputation: 12260

apt-get install -y python3-rpy2

Upvotes: 0

Paul Bendevis
Paul Bendevis

Reputation: 2621

This solution worked for me because it's actually a header issue: https://stackoverflow.com/a/23085474/7049567

sudo apt-get install libreadline-dev 

Or

yum install readline-devel

Upvotes: 0

Gabriel
Gabriel

Reputation: 42329

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

Upvotes: 7

lgautier
lgautier

Reputation: 11545

It is indicated in the full output.

It has to do with how R was compiled and/or installed. Rpy2 is expecting a header that cannot be found:

   ./rpy/rinterface/r_utils.c:32:31: fatal error: R_ext/Rallocators.h: No existe el archivo o el directorio
 #include <R_ext/Rallocators.h>

Upvotes: 2

Related Questions