3

I am trying to get netmiko (which uses paramiko) installed on Raspbian Jessie so that I can script SSH commands from my Pi. It doesn't seem to be that netmiko works out-of-the-box as I had hoped. So here I am.

The cryptography library is a requirement and this is what I am struggling with. From a fresh Jessie image I went and run the following from the terminal in sequence:

# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install gcc libffi-dev libssl-dev python-dev
# sudo pip install cryptography

Everything installs ok, however the last command returns:

Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
    import packaging.version
ImportError: No module named packaging.version

When I now run # pip on its own I get the following returned:

Traceback (most recent call last):
  File "/usr/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
    import packaging.version
ImportError: No module named packaging.version

I have been through the commands I run and pip works at every stage before the install cryptography command. It's like the cryptography install script broke pip.

Any help would be appreciated. I am new to Python and Linux.

2

4 Answers 4

2

Re-installing pip seems to have fixed it. Thanks to goobering's link in his comment.

I downloaded get-pip.py from this section of the python website, then from terminal run sudo python get-pip.py.

Since pip is now working I then run sudo pip install netmiko and tested from Python: from netmiko import ConnectHandler

Full list of commands to get netmiko working on fresh Raspbian Jessy image:

# sudo apt-get update
# sudo apt-get upgrade
# sudo apt-get install gcc libffi-dev libssl-dev python-dev
# sudo pip install cryptography
# wget https://bootstrap.pypa.io/get-pip.py
# sudo python get-pip.py
# sudo pip install netmiko
1
  • Can confirm netmiko is "talking" to my Cisco 1921 router.
    – JamesGohl
    Commented Feb 23, 2017 at 20:22
2

I found the following commands were sufficient to fix my Raspbian Jessie install where Kodi was giving an error message about the old version of Python Cryptography.

sudo apt-get update  
sudo apt-get upgrade  
sudo apt-get install libffi-dev libssl-dev python-dev  
sudo pip install setuptools  
sudo pip install cryptography
0

When using the follow above suggest commands to fix my Raspbian Jessy install of Kodi's error message on the Python Cryptography version error. I used this suggested Full list of commands to get netmiko working on fresh Raspbian Jessy image:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gcc libffi-dev libssl-dev python-dev
sudo pip install cryptography
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install netmiko

But, I got back an error message stating that I needed an updated setuptools so on trying the last line. so I found the follow suggested code on another help thread and tried

sudo python -m pip install --upgrade pip setuptools wheel

and then

sudo pip install netmiko

this seemed to allowed netmiko to install and when I went into kodi I did not get the cryptography error.

0

if pip is not installed, first try sudo wget https://bootstrap.pypa.io/get-pip.py

after that, using sudo python get-pip.py install the pip. and then try sudo pip install netmiko

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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