Yelp/kafka-utils

paramiko dependency check?

brettrann opened this issue · 2 comments

Hi. I'm a bit of a noob with python, so excuse if this doesn't belong here.

On an ubuntu 12 system (yah!) I installed kafka-utils through pip and got 1.3.1, with python 2.7. when trying the rolling restart it gave this error:

Traceback (most recent call last):
  File "/usr/local/bin/kafka-rolling-restart", line 3, in <module>
    from kafka_utils.kafka_rolling_restart.main import run
  File "/usr/local/lib/python2.7/dist-packages/kafka_utils/kafka_rolling_restart/main.py", line 36, in <module>
    from kafka_utils.util.ssh import report_stderr
  File "/usr/local/lib/python2.7/dist-packages/kafka_utils/util/ssh.py", line 25, in <module>
    from paramiko.agent import AgentRequestHandler
ImportError: cannot import name AgentRequestHandler

The error was resolved by uninstalling and reinstalling paramiko

Uninstalling paramiko-1.7.7.1:
  /usr/lib/python2.7/dist-packages/paramiko-1.7.7.1.egg-info
Proceed (y/n)? y
  Downloading paramiko-2.4.0-py2.py3-none-any.whl (192kB)
Requirement already satisfied: cryptography>=1.5 in /usr/local/lib/python2.7/dist-packages (from paramiko)
Collecting pynacl>=1.0.1 (from paramiko)
  Downloading PyNaCl-1.2.0-cp27-cp27mu-manylinux1_x86_64.whl (696kB)
Collecting pyasn1>=0.1.7 (from paramiko)
  Downloading pyasn1-0.4.2-py2.py3-none-any.whl (71kB)
Collecting bcrypt>=3.1.3 (from paramiko)
  Downloading bcrypt-3.1.4-cp27-cp27mu-manylinux1_x86_64.whl (57kB)

Despite this being an old ubuntu, I'd have thought kafka-utils would handle the correct dependency?

I'll just add I reinstalled kafka-utils and got 1.3.3, and so to have had 1.3.1 it must have already been installed there. Maybe this was already addressed. Or was some artefact of the earlier work. 🤷‍♂️

You're right, paramiko.agent.AgentRequestHandler isn't present in 1.7.7 (see on GitHub).

It seems this was introduced in 1.8.0 (see on GitHub).

It certainly would make sense to have a minimal pin of 1.8.0 for Paramiko in the code; feel free to submit a PR to add this.

Glad to hear you were able to resolve your issues with this.