docker-py icon indicating copy to clipboard operation
docker-py copied to clipboard

Broken dependency on six

Open andyp1per opened this issue 12 years ago • 5 comments

Trying to use ansible on Amazon Linux EC instances with docker-py. My playbook does this:

  • command: easy_install pip creates=/usr/bin/pip
  • command: pip install docker-py creates=/usr/lib/python2.6/site-packages/docker/client.py
  • command: pip install --upgrade six

The last step should not be necessary but if I omit it I get this:

failed: [54.172.99.39] => {"failed": true, "parsed": false} invalid output was: SUDO-SUCCESS-fivtwwcvtrwybqrmybkqqvlzvtlnqjqw Traceback (most recent call last): File "/home/ec2-user/.ansible/tmp/ansible-tmp-1412696774.24-69218506797267/docker", line 312, in from docker.client import APIError as DockerAPIError File "/usr/lib/python2.6/site-packages/docker/init.py", line 20, in from .client import Client # flake8: noqa File "/usr/lib/python2.6/site-packages/docker/client.py", line 30, in from . import errors ImportError: cannot import name errors

FATAL: all hosts have already failed -- aborting

andyp1per avatar Oct 07 '14 15:10 andyp1per

Having a similar problem with python 2.7

fatal: [ec2] => failed to parse: sudo: unable to resolve host ip-10-10-13-87 sudo: unable to resolve host ip-10-10-13-87 SUDO-SUCCESS-kefkggunwgxqydlrtskqnagxkxyturbw Traceback (most recent call last): File "/home/ubuntu/.ansible/tmp/ansible-tmp-1413477069.2-52467766880601/docker_image", line 1598, in main() File "/home/ubuntu/.ansible/tmp/ansible-tmp-1413477069.2-52467766880601/docker_image", line 234, in main image_id = manager.build() File "/home/ubuntu/.ansible/tmp/ansible-tmp-1413477069.2-52467766880601/docker_image", line 144, in build for chunk in stream: File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 270, in _stream_helper socket_fp = socket_obj(_sock=self._get_raw_response_socket(response)) File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 265, in _get_raw_response_socket sock._response = response AttributeError: '_socket.socket' object has no attribute '_response'

FATAL: all hosts have already failed -- aborting

AgentO3 avatar Oct 16 '14 17:10 AgentO3

Similar problem happened to me with python2.7 and local machine

With six 1.3 (written as dependency in setup.py), got following erors.

$ sudo pip install six==1.3
$ python
>>> import docker
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/docker/__init__.py", line 20, in <module>
    from .client import Client, AutoVersionClient # flake8: noqa
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 35, in <module>
    import websocket
  File "/usr/lib/python2.7/site-packages/websocket/__init__.py", line 22, in <module>
    from ._core import *
  File "/usr/lib/python2.7/site-packages/websocket/_core.py", line 41, in <module>
    from ._url import *
  File "/usr/lib/python2.7/site-packages/websocket/_url.py", line 23, in <module>
    from six.moves.urllib.parse import urlparse
ImportError: No module named urllib.parse

With six 1.4, works correctly.

$ sudo pip install six==1.4
$ python
Python 2.7.5 (default, May  5 2014, 09:13:10)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker

Hi-king avatar May 13 '15 05:05 Hi-king

Hm, it would probably be wise to require a more recent version of six. Thanks for reporting this.

shin- avatar May 13 '15 20:05 shin-

Encountered this problem today. Thanks for the workaround @Hi-king !

gdw2 avatar Jul 06 '15 14:07 gdw2

Also encountered on my system: CentOS 7 with Python 2.7.5. Thks @Hi-king !

nicolargo avatar Jul 30 '15 12:07 nicolargo