1

I am trying to install various python packages using pip in my virtual environment but couldn't install. If I try to install the same package not in virtual environment then it gets installed. Every time I get the different errors. I am pasting one of the errors below which I got while installing scrapy.

Command "/home/namita/venv/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-AHL0d8/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-Dk98DU-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/namita/venv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-AHL0d8/cffi

And I also get below mentioned warning:

/home/namita/venv/local/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning

I tried visiting https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning but was not satisfied.

Hayley Guillou
  • 3,953
  • 4
  • 24
  • 34
Namita Maharanwar
  • 701
  • 1
  • 6
  • 21

2 Answers2

1

I tried visiting https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning but was not satisfied.

The solution is quite clear :

If you encounter this warning, it is strongly recommended you upgrade to a newer Python version, or that you use pyOpenSSL as described in the OpenSSL / PyOpenSSL section.

If you do not want to upgrade your Python version (>2.7.9), install the following packages :

$ pip install pyopenssl ndg-httpsclient pyasn1

It has been proven to work for other similar issues :

Community
  • 1
  • 1
lucasg
  • 10,734
  • 4
  • 35
  • 57
  • Thank you @georgesl. I did not want to upgrade python version. That warning is not coming now. And some packages have installed now. But again for certain packages, I am getting this error " Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-jly38Q/nltk " – Namita Maharanwar Jul 10 '15 at 09:10
0

From a fresh installation of 14.04, I had to install python-dev, libffi-dev, libssl-dev, libxml2-dev, and libxslt1-dev packages. Once those were installed, pip install scrapy worked fine.

sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev
pip install scrapy
M.A.K. Simanto
  • 634
  • 1
  • 7
  • 20