Paramiko: AttributeError: 'module' object has no attribute 'GSSException'

Created on 19 Sep 2017  路  5Comments  路  Source: paramiko/paramiko

Hi, guys!

Facing the Exception mentioned in title simply by importing the latest version (2.3.0) of paramiko:

>>> import paramiko

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/paramiko/__init__.py", line 31, in
from paramiko.transport import SecurityOptions, Transport
File "/usr/lib/python2.7/site-packages/paramiko/transport.py", line 38, in
from paramiko.auth_handler import AuthHandler
File "/usr/lib/python2.7/site-packages/paramiko/auth_handler.py", line 48, in
from paramiko.ssh_gss import GSSAuth, GSS_EXCEPTIONS
File "/usr/lib/python2.7/site-packages/paramiko/ssh_gss.py", line 54, in
GSS_EXCEPTIONS = (gssapi.GSSException,)
AttributeError: 'module' object has no attribute 'GSSException'

Problem appeared after upgrade this evening:
pip install --upgrade paramiko

Re-installation of modules doesn't help:
pip unistall paramiko; pip install paramiko
neither
pip install --force-reinstall --upgrade paramiko

Version of pip:
[root@hostname]# pip --version pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)

Python:

Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2

It this fault in my installation?

Most helpful comment

pip uninstall gssapi works for me
paramiko verison 2.4

All 5 comments

That GSSException thing was introduced in #1061. But the other cause of your problem might be that you have the "wrong" gssapi installed (whereas having no gssapi module installed would be OK) - see #861

cc @akruis

Can someone advise on how to uninstall gssapi module? The playbooks are failing for Aruba and IOS network modules.


ansible 2.4.3.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/user/ycaty/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Nov 6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

pip freeze | grep gssapi
gssapi==1.2.0
pip freeze | grep paramiko
paramiko==2.4.1
python --version
Python 2.7.5


e<1x.xx.xx.x1> socket_path: None
fatal: [Aruba-IAP]: FAILED! => {
"changed": false,
"failed": true,
"msg": "unable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell"
}
Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell"}

Log file output:
Getting below error :

2018-03-15 10:45:13,488 p=7276 u=root | 1 plays in Aruba_GetConfig_All.yml
2018-03-15 10:45:13,520 p=7276 u=root | PLAY [ArubaAll] ************************************************************************
2018-03-15 10:45:13,544 p=7276 u=root | TASK [Gathering Facts]
**********************************************************************
2018-03-15 10:45:13,816 p=7276 u=root | Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
2018-03-15 10:45:13,817 p=7276 u=root | Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
2018-03-15 10:45:13,817 p=7276 u=root | Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
2018-03-15 10:45:13,818 p=7276 u=root | Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py
2018-03-15 10:45:14,165 p=7276 u=root | ok: [STG-IAP]
2018-03-15 10:45:14,193 p=7276 u=root | META: ran handlers
2018-03-15 10:45:14,199 p=7276 u=root | TASK [RETRIEVE CONFIGURATION FILE]
*******************************************************************
2018-03-15 10:45:14,199 p=7276 u=root | task path: /home/ycaty/Aruba_GetConfig_All.yml:14
2018-03-15 10:45:14,971 p=7502 u=root | creating new control socket for host 1x.xx.xx.x:2x as user admin
2018-03-15 10:45:14,972 p=7502 u=root | control socket path is /root/.ansible/pc/0726dffd4d
2018-03-15 10:45:14,996 p=7504 u=root | using connection plugin network_cli
2018-03-15 10:45:15,017 p=7502 u=root | failed to create control socket for host 1x.xx.xx.x
2018-03-15 10:45:15,019 p=7502 u=root | Traceback (most recent call last):
File "/bin/ansible-connection", line 315, in main
server = Server(socket_path, pc)
File "/bin/ansible-connection", line 111, in init
self.connection = connection_loader.get(play_context.connection, play_context, sys.stdin)
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 363, in get
self._module_cache[path] = self._load_module_source(name, path)
File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 339, in _load_module_source
module = imp.load_source(full_name, path, module_file)
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 61, in
from ansible.plugins.connection.paramiko_ssh import Connection as _Connection
File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/paramiko_ssh.py", line 94, in
import paramiko
File "/usr/lib/python2.7/site-packages/paramiko/init.py", line 22, in
from paramiko.transport import SecurityOptions, Transport
File "/usr/lib/python2.7/site-packages/paramiko/transport.py", line 38, in
from paramiko.auth_handler import AuthHandler
File "/usr/lib/python2.7/site-packages/paramiko/auth_handler.py", line 48, in
from paramiko.ssh_gss import GSSAuth, GSS_EXCEPTIONS
File "/usr/lib/python2.7/site-packages/paramiko/ssh_gss.py", line 54, in
GSS_EXCEPTIONS = (gssapi.GSSException,)
AttributeError: 'module' object has no attribute 'GSSException'

pip uninstall gssapi works for me
paramiko verison 2.4

I am getting this on an ansible playbook (I haven't run the playbook for a while but no changes have been made on my end) and I cannot remove the 'wrong' gssapi because it's required by another package on my system (freeipa-client on Ubuntu 16.04). Does anyone have an alternate workaround?

See #1311 please!

Was this page helpful?
0 / 5 - 0 ratings