1

system info :

Ubuntu 14.10
Linux vagrant-ubuntu-trusty 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

I first install virtualenv in ubuntu

sudo pip install virtualenv
virtualenv scrapy-env
cd scrapy-env/
source bin/activate
pip install scrapy

then I get this error:

  running build_ext
    building 'twisted.test.raiser' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    creating build/temp.linux-x86_64-2.7/src/twisted
    creating build/temp.linux-x86_64-2.7/src/twisted/test
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-2.7/src/twisted/test/raiser.o
    src/twisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/vagrant/pyenv/scrapy-env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-NJKTtN/Twisted/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_i2ueH-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/pyenv/scrapy-env/include/site/python2.7/Twisted" failed with error code 1 in /tmp/pip-build-NJKTtN/Twisted/

Any suggestions that could help me fix it?

vezunchik
  • 3,669
  • 3
  • 16
  • 25
code.g
  • 143
  • 1
  • 1
  • 14
  • Please read the [installation docs](https://doc.scrapy.org/en/latest/intro/install.html#ubuntu-12-04-or-above)! – Klaus D. Dec 21 '17 at 05:59
  • Possible duplicate of [fatal error: Python.h: No such file or directory](https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory) – phd Dec 21 '17 at 10:36

1 Answers1

1

You don't have Python developer package installed. Try installing them

sudo apt-get install python-dev # for python2.x installs
sudo apt-get install python3-dev  # for python3.x installs
vezunchik
  • 3,669
  • 3
  • 16
  • 25
Naks
  • 361
  • 3
  • 10
  • I get this error after run `sudo apt-get install python-dev `: `The following packages have unmet dependencies: python-dev : Depends: python (= 2.7.5-5ubuntu3) but 2.7.8-1 is to be installed Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not going to be installed Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.` – code.g Dec 21 '17 at 06:10
  • try updating python first – Naks Dec 21 '17 at 06:35