$ pip freeze | grep pysftp
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal import main
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
from pip._internal import cmdoptions
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
from pip._internal.index import (
File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
from pip._vendor import html5lib, requests, six
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
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 118, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
it looks like your python installation is broken, or at least pip is broken. more specifically, it looks like your python installation is expecting a specific openssl backend implementation, but it is not there. perhaps something else failed when you were installing other packages and you ignored or missed the failures?
beware that you can easily screw up your operating system if you sometimes use pip to install python packages but other times use apt. this is more of a problem on redhat and derivatives, but it can also bite you on debian and its derivatives. in general, you should use one or the other.
unfortunately it looks like the pysftp module is not available as a debian/ubuntu package. so you must do a pip install or install pysftp directly from its source.
anyway, you need to fix your python installation before you can do anything else. it is really hard to say how to do that without knowing exactly what commands you executed to get the system into its current, broken state.