Forums

AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

I was working on using the django-push-notifications package in my Django web application. In order for it to work correctly, I had to upgrade pip along with the django-push-notifications package. Ever since I have done that, every time I run "pip install" or "pip uninstall" on any package, I get the following error:

File "/usr/local/bin/pip", line 7, in <module>
    from pip import main
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 16, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/local/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 39, in <module>
    from pip._vendor import requests, six
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 53, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py", line 54, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 124, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

I also get that error whenever I try to perform migrations as well on "python manage.py migrate"

I tried to reset my server by deleting my web app and starting over again, but I get the same error even after that. Is there a way to completely reset the server to be factory settings?

That's a very strange state to get into. ONe thing that might be worth trying is:

rm -rf ~/.local/*

from a Bash console?