Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing scrapy [duplicate]

I'm trying to install scrapy using the command sudo pip install scrapy, but I'm getting an error message which ends as follows:

build/temp.linux-x86_64-2.7/_openssl.c:429:30: fatal error: openssl/opensslv.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-tVcVY7/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zyty58-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-tVcVY7/cryptography/

The error seems to be related to OpenSSL, which needs to be installed according to http://doc.scrapy.org/en/latest/intro/install.html. However, if I run sudo apt-get install openssl, I get a message which seems to indicate it is already installed:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssl is already the newest version (1.0.2g-1ubuntu4.1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-21 linux-headers-4.4.0-21-generic linux-headers-4.4.0-22
  linux-headers-4.4.0-22-generic linux-image-4.4.0-21-generic
  linux-image-4.4.0-22-generic linux-image-extra-4.4.0-21-generic
  linux-image-extra-4.4.0-22-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 135 not upgraded.

How can I solve this to install scrapy?

like image 725
Kurt Peek Avatar asked Feb 15 '26 02:02

Kurt Peek


2 Answers

Use Ubuntu package manager apt-get to install scrapy. apt-get will automatically take care of the dependencies

sudo apt-get install python-scrapy
like image 90
Jobin Avatar answered Feb 18 '26 07:02

Jobin


As it says in the install documentation, you should run the following:

sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
like image 32
Dean Fenster Avatar answered Feb 18 '26 07:02

Dean Fenster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!