Aniruddh
Aniruddh

Reputation: 188

Error while installing Scrapy for python3

I used pip to install Scrapy for Python3 in Ubuntu

sudo pip3 install scrapy

While installing I get this error

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.5m -c src/twisted/test/raiser.c -o build/temp.linux-x86_64-3.5/src/twisted/test/raiser.o
    src/twisted/test/raiser.c:4:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_il8a07a/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-9935fpm4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-_il8a07a/Twisted/

Upvotes: 1

Views: 1646

Answers (2)

Tarun Lalwani
Tarun Lalwani

Reputation: 146520

As mentioned you were missing the dev dependencies

For python 2

sudo apt install -y python-dev
sudo pip install scrapy

For python 3

sudo apt install -y python3-dev
sudo pip3 install scrapy

Upvotes: 6

Aniruddh
Aniruddh

Reputation: 188

Run the following command

sudo apt install -y python3-dev

After that install scrapy

sudo pip3 install scrapy

Upvotes: 0

Related Questions