3

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?

Kurt Peek
  • 52,165
  • 91
  • 301
  • 526

3 Answers3

4

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

sudo apt-get install python-scrapy
Jobin
  • 6,506
  • 5
  • 24
  • 26
  • [Documentation](http://doc.scrapy.org/en/latest/intro/install.html#ubuntu-9-10-or-above) actually says "Don’t use the python-scrapy package provided by Ubuntu, they are typically too old and slow to catch up with latest Scrapy." – Dean Fenster Jul 12 '16 at 17:47
3

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
Dean Fenster
  • 2,345
  • 1
  • 18
  • 27
3

The problem was that I had to install the OpenSSL development package via the command sudo apt-get install libssl-dev.

Kurt Peek
  • 52,165
  • 91
  • 301
  • 526