1

I am trying to properly set up python-goose in a virtualenv.

Update: I nuked python and started with a clean install as outlined here.

I followed the python-goose instructions and did:

mkvirtualenv --no-site-packages goose
git clone https://github.com/grangier/python-goose.git
cd python-goose
pip install -r requirements.txt
python setup.py install

pip install -r requirements.txt fails on lxml

Error I get now is:

error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /Users/me/.virtualenvs/goose/bin/python -c "import setuptools, tokenize;__file__='/Users/me/.virtualenvs/goose/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/wg/82j6ndq50tl4m9rjkqszyx8r0000gp/T/pip-c9DtYT-record/install-record.txt --single-version-externally-managed --compile --install-headers 
/Users/me/.virtualenvs/goose/include/site/python2.7 failed with error code 1 in   
/Users/me/.virtualenvs/goose/build/lxml

Is there anything I am doing incorrectly or are there any alternative ways I can try to get this working?

e h
  • 8,435
  • 7
  • 40
  • 58
  • 1
    Looks like your problem is still within lxml, from your folder structure I assume you are running OS X, are you using homebrew? – Wolph Mar 10 '14 at 11:54
  • Hello, yes, running Mavericks and I have homebrew on this machine. – e h Mar 10 '14 at 12:09
  • 1
    It looks like you're missing a compression related package, possibly in your Python distribution. Did you build it yourself? – Nicola Musatti Mar 10 '14 at 12:25
  • I am pretty sure I went to www.python.org/download/ and grabbed 2.7 from there. – e h Mar 10 '14 at 12:34
  • 2
    I would recommend running Python through homebrew instead. It tends to have all packages needed so you don't have these issues. In this case I think you need both `python` and `libxml2`. – Wolph Mar 10 '14 at 13:12
  • @Wolph I just installed `python` with brew and `libxml2` is also installed. However, now when I try to install lxml I get a different error (added to answer). – e h Mar 11 '14 at 17:47
  • 1
    @emh: that doesn't really help much, I have just executed the install and everything locally and I have no problems so it must be in one of the deps. Where is it dying right now? At the `pip install -r requirements.txt`? – Wolph Mar 11 '14 at 20:26
  • Yes, at the `lxml` stage. – e h Mar 11 '14 at 20:33
  • 1
    install the lxml package with pip, i.e. `pip install lxml`, and also make sure that you're using the correct python with `which python`. If it is not `/usr/local/bin/python` then you aren't using the homebrew version of python – pseudocubic Mar 11 '14 at 20:36
  • 1
    Pseudocubic does raise a good point, are you sure the virtualenv was created with the brew version of python? If it wasn't, you'll have to recreate the virtualenv (trash the old, create a new). – Wolph Mar 12 '14 at 09:57
  • @Wolph: just trashed it and started over. @pseudocubic outside of my virtualenv `which python` yields: `/usr/local/bin/python` so that looks ok. I tried and was able to install `lxml` globally. When I `workon goose` and run `which python` it yields: `/Users/me/.virtualenvs/goose/bin/python` is that correct? – e h Mar 12 '14 at 10:23
  • 1
    Yes, that should be correct :) Alternatively, you can also enable the global site packages to use the global lxml of course. – Wolph Mar 12 '14 at 10:40
  • @Wolph, seems like the only option at the moment, but when I run `mkvirtualenv goose --system-site-packages` then `workon goose` and `pip install lxml -I` and I still get the same error. – e h Mar 12 '14 at 10:54

1 Answers1

1

Finally found a solution:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

Seems like this error is caused by the latest clang update from Apple that came with Xcode 5.1

"Update: Did not expect this to get so much attention, but here's more detail: the clang 3.4 Apple is shipping defaults to erroring on unknown flags, but CPython builds modules using the same set of flags it was compiled with originally. The system CPython was compiled with several flags that are unknown by clang, thus causing this problem."

Read more here: https://stackoverflow.com/a/22315129/2673189

Again, thanks to Wolph and pseudocubic, you were very helpful.

Community
  • 1
  • 1
e h
  • 8,435
  • 7
  • 40
  • 58