14

I'm trying to install ReportLab 2.4 on a 10.04.2 server with virtualenv. In the ReportLab_2_4 folder I use:

python setup.py install

and the error I get:

error: command 'gcc' failed with exit status 1

Don Kirkby
  • 53,582
  • 27
  • 205
  • 286
user780862
  • 141
  • 1
  • 1
  • 4
  • What GCC do you have ? - Try updating it as it may have changed. – Louis Sep 06 '11 at 20:02
  • 5
    If you are running debian based system try: `sudo apt-get install python-dev` – Ski Sep 06 '11 at 20:49
  • Also you can scroll up through the error log to the line which tells what exactly the error is. You are missing some development libraries. This command might filter out useful message: `python setup.py install 2>&1 | grep missing` – Ski Sep 06 '11 at 20:52
  • @Skirmantas: both tips was usefull. Appreciate that! – user780862 Sep 07 '11 at 12:24
  • I get the same error, using both `pip` and `easy_install`. The most pertinent error is this: `/env/build/reportlab/src/rl_addons/rl_accel/_rl_accel.c:11:20: fatal error: Python.h: No such file or directory`. I *have* installed `python-dev`. And building outside of the virtualenv works fine. But as soon as the env is activated it won't find `Python.h` anymore :( – exhuma Oct 12 '11 at 11:19

3 Answers3

13

As Skimantas said, I think you should install python-dev. sudo apt-get install python-dev and I was able to install reportlab into my home directory with command "pip install reportlab" without sudo as mentioned earlier answer. I need only root access to install python-dev.

Shortly..

I installed virtualenv

sudo apt-get install python-setuptools
sudo easy_install virtualenv
virtualenv --no-site-packages virtual01

I installed

sudo apt-get install python-dev

I activate my virtual environment just to be sure...

source  ~/virtual01/bin/activate

cd ~/virtual01/bin
pip install reportlab

And that's it.

(I just recorded what I did in Ubuntu 10.04 LTS)

Oli
  • 235,628
  • 64
  • 220
  • 299
Eino Mäkitalo
  • 408
  • 3
  • 11
  • I get the same error, using both `pip` and `easy_install`. The most pertinent error is this: `/env/build/reportlab/src/rl_addons/rl_accel/_rl_accel.c:11:20: fatal error: Python.h: No such file or directory`. I *have* installed `python-dev`. And building outside of the virtualenv works fine. But as soon as the env is activated it won't find `Python.h` anymore :( – exhuma Oct 12 '11 at 11:18
  • I still had to run as sudo, but likely related to my virtual box I'm using. Otherwise this did the trick for me! – kyleturner Sep 13 '12 at 05:37
0

I got a very similar error trying to install Reportlab on Mac OS X, which I'd recently upgraded to 10.9. Run Xcode, agree the the new license agreement, and try again.

0

On the outside chance anyone is deploying reportlab to AWS EC2 / ElasticBeanstalk...My solution is below.

deactivate && sudo pip install reportlab
sudo cp -r /usr/local/lib64/python2.7/site-packages/reportlab /opt/python/run/venv/lib/python2.7/site-packages/

It's super hacky, but it's a workaround to get it running on my django stack with AWS ElasticBeanstalk. I just just modified .ebextensions/02_python.config to execute the above before continuing further, i think it is set to execute 2nd, after using pip to install requirements.txt to the venv.

  • This isn't specific to AWS EC2. Why would `sudo pip install` work when `pip install` in the virtual env didn't? – Martijn Pieters Jul 30 '15 at 07:25
  • @MartijnPieters `pip install reportlab` while in the venv would fail, however running `deactivate` then `sudo pip install reportlab` would successfully install reportlab, then I just copied it out to the venv directory. I tested that it installed correctly by activating the environment and firing up python's REPL and importing reportlab. Everything works. EDIT: I suppose the directories aren't specific to EC2. – Adam Heller Jul 30 '15 at 14:55
  • @Tech1: so your superuser environment contains the right environment variables to build an extension. Perhaps it is time to figure out what is missing in your regular environment? – Martijn Pieters Jul 30 '15 at 14:56