Deepti K
Deepti K

Reputation: 599

Importing test library 'SSHLibrary' fails with the ImportError "Importing Paramiko library failed. Make sure you have Paramiko installed."

I am trying to run robot framework test cases which uses SSHLibrary. I have installed all the required libraries (paramiko in this case). But I still get this error.

The error I get is:

Error in file '/opt/bdd_keywords.robot': Importing test library 'SSHLibrary' failed: ImportError: Importing Paramiko library failed. Make sure you have Paramiko installed.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/__init__.py", line 15, in <module>
    from .library import SSHLibrary
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/library.py", line 22, in <module>
    from .client import SSHClient
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/client.py", line 20, in <module>
    from pythonclient import PythonSSHClient as SSHClient
  File "/usr/local/lib/python2.7/dist-packages/SSHLibrary/pythonclient.py", line 20, in <module>
    'Importing Paramiko library failed. '

PYTHONPATH:

  /usr/local/lib/python2.7/dist-packages/robot/libraries

  /usr/local/lib/python2.7/dist-packages

  /usr/local/bin

  /usr/lib/python2.7

  /usr/lib/python2.7/plat-x86_64-linux-gnu

  /usr/lib/python2.7/lib-tk

  /usr/lib/python2.7/lib-old

  /usr/lib/python2.7/lib-dynload

  /usr/lib/python2.7/dist-packages
  .'

When I tried to install paramiko again, I get the below output:

`Requirement already satisfied (use --upgrade to upgrade): paramiko in /usr/local/lib/python2.7/dist-packages/paramiko-1.15.2-py2.7.egg

Requirement already satisfied (use --upgrade to upgrade): pycrypto!=2.4,>=2.1 in /usr/local/lib/python2.7/dist-packages (from paramiko)

Requirement already satisfied (use --upgrade to upgrade): ecdsa>=0.11 in /usr/local/lib/python2.7/dist-packages (from paramiko)`

P.S: I am trying to run this test on a Docker container. DatabaseLibrary keywords work fine.

Upvotes: 2

Views: 9914

Answers (4)

Manjul Verma
Manjul Verma

Reputation: 1

Faced same issue when I try to import SSHLibrary in Python 2.7. Paramiko uses enum package. The problem is that the enum package wasn't added to Python until version 3.4.

It has been back ported in lower versions of Python you just need the package from here: https://pypi.python.org/pypi/enum34#downloads

or try

"pip install enum" to get the issue resolved.

Upvotes: 0

Sumedh J
Sumedh J

Reputation: 1

Windows: Download the

pycrypto-2.6.win-amd64-py2.7.exe

and run the exe. then in command prompt execute python -c "import SSHLibrary" execution of this command shouldn't report any messages

Upvotes: 0

janne
janne

Reputation: 1017

This is an incompatibility between the Python interpreter and paramiko c-extension. See http://effbot.org/pyfaq/when-importing-module-x-why-do-i-get-undefined-symbol-pyunicodeucs2.htm for details

You have to either

  • install a different Python version
  • or build and install paramiko from sources, instead of using pip

Upvotes: 2

Blue
Blue

Reputation: 501

SSHLibrary uses paramiko module.

pip install paramiko

still problem exists, check if 2 python versions exists, then paramiko may installed in one version and default python is another.

Upvotes: -1

Related Questions