Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I bought a new macbook and I am so new to mac os. However, I read a lot on internet about how to install scrap

I did everything, but i have a problem with installing lxml

I tried this on terminal

pip install lxml

and a lot of stuff started to be downloading and many text was written on the terminal, but i got this error message on red in the terminal

1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
Cleaning up...
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools, tokenize;__file__='/private/var/folders/rd/fxgsy46j3l77f6l9h_hv2fjm0000gn/T/pip_build_mycomputername/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/rd/fxgsy46j3l77f6l9h_hv2fjm0000gn/T/pip-WvDTPQ-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/rd/fxgsy46j3l77f6l9h_hv2fjm0000gn/T/pip_build_mycomputername/lxml
Storing debug log for failure in /Users/mycomputername/.pip/pip.log

and now when I call scrapy spider that words with lxml, i got this error message

ImportError: No module named lxml.html

what should I do please?

any suggestion is appreciated

I think this is a duplicate question. you can find your ans [here][1]. This might also help center[2]. [1]: stackoverflow.com/questions/10666578/… – DarKnight May 23, 2015 at 7:26 @DarKnight the link you provided states that i have to go to Xcode then preferences then download and download the command line tools. However, i went there and there wasn't command line tools. there was just some updates for the os and some iOS simulators to install – Marco Dinatsoli May 23, 2015 at 8:04

installed all xcode (2.8GB) from apple store.

to be sure that the installation is successfully finished: open terminal and typed

xcode-select -p

you should get something like this:

/Applications/Xcode.app/Contents/Developer

now you need to install command line tools. try to type gcc on the terminal, then there are two possibilities: either you get a window asking to install the tools and you have to click on install, or you will get an error message.

if you get an error message, then don't worry just try to install the tools using this command xcode-select --install

after that restart the mac and then re install lxml again like this :

pip install lxml

then try to run scrapy again

if you encounter any other error on any other library, easily just reinstall scrapy using easy_install and NOT using pip

This probably happens because you did not re-install the Command Line Tools after upgrading.

Usually XCode should be upgraded to the latest version (4.4) (I believe when I updated to 10.8 I also updated a whole bunch of other applications, including XCode). After the update you need to re-install the Command Line Tools. This can now be done via a setting in XCode:

Go to "Preferences -> Downloads" and install "Command Line Tools".

why you talking about xcdoe? i have never upgraded the Xcode or the mac os. i bought the mac just a week ago and installed Xcode. – Marco Dinatsoli May 23, 2015 at 7:59 i went there and there wasn't command line tools. there was just some updates for the os and some iOS simulators to install – Marco Dinatsoli May 23, 2015 at 8:04

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.