I have a Kali Linux distrubution which is Kali GNU/Linux Rolling (currently version 2017.3) on amd64. I'm keeping it regularly up to date and have not meddled with system files or the package management. Yet, some time ago python2 and OpenSSL stopped playing together. In the beginning this was simply odd but now it is a major nuisance. E.g. a simple call like this fails:

# pip
/usr/lib/python2.7/dist-packages/cffi/model.py:532: UserWarning: 'point_conversion_form_t' has no values explicitly defined; guessing that it is equivalent to 'unsigned int'
  % self._get_c_name())
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 64, in <module>
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
  File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 4, in <module>
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/__init__.py", line 52, in <module>
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/packages/__init__.py", line 59, in <module>
  File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/packages/__init__.py", line 32, in vendored
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 47, in <module>
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 112, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'FFILibrary' object has no attribute 'Cryptography_HAS_SSL_ST'

Sifting thorough various search engine results I found out that this seems to be a known incompatibility problem, but apparently there is no tangible clean solution. What puzzles me is that how can that happen in an actively maintained distro? (In fact, a collegue with the same setup does not have this problem.)

Is there a simple way to repair/fix this without reinstalling the whole distribution?

The installed versions are python/kali-rolling 2.7.14-1, python-openssl/kali-rolling 16.2.0-1 and python-cffi/kali-rolling 1.9.1-2.


I'm assuming you have installed pip from the distribution repositories?

If so, just remove current version of pip and install it with get-pip.py:

curl -o ./get-pip.py https://bootstrap.pypa.io/get-pip.py
python3 ./get-pip.py
python2 ./get-pip.py

This should pull all the appropriate dependencies and your pip will start working again.

  • Thanks. Yes pip comes from the distribution. Before I commence: What does get-pip.py do, and in which way is this the recommended way to proceed? – countermode Nov 30 '17 at 15:44
  • Take a look to pip docs. – NarūnasK Nov 30 '17 at 15:48
  • Hmm, if I attempt to remove python-pip, the package manager tells me: The following packages will be REMOVED: golismero kali-linux-full python-pip. Umm... – countermode Dec 6 '17 at 12:05

Stuff in /usr/lib/python2.7/dist-packages was the culprit - thanks to strace. Removing it solved the issue.

Lesson learned: Use virtual environments for programs that require non-standard packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.