Docker-py: AttributeError: 'module' object has no attribute 'PY34'

Created on 27 Mar 2019  路  3Comments  路  Source: docker/docker-py

While attempting to build and run this inside a docker container i get errors. Here's my setup:

Container image base: Rasbian Jessie

Commands ran to upgrade python and install:

RUN apt-get update && apt-get upgrade -y
RUN apt-get install build-essential
RUN apt-get install python3-pip python3-dev
RUN apt-get install libevent-dev
RUN apt-get install libffi-dev
RUN apt-get install libffi6
RUN apt-get install -y libltdl7
RUN easy_install -U pip
RUN pip3 install six

And wheres what i get when importing docker:

File "/docker_api.py", line 4, in
import docker
File "/usr/local/lib/python3.4/dist-packages/docker/__init__.py", line 2, in
from .api import APIClient
File "/usr/local/lib/python3.4/dist-packages/docker/api/__init__.py", line 2, in
from .client import APIClient
File "/usr/local/lib/python3.4/dist-packages/docker/api/client.py", line 8, in
import websocket
File "/usr/local/lib/python3.4/dist-packages/websocket/__init__.py", line 23, in
from ._app import WebSocketApp
File "/usr/local/lib/python3.4/dist-packages/websocket/_app.py", line 36, in
from ._core import WebSocket, getdefaulttimeout
File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 34, in
from ._handshake import *
File "/usr/local/lib/python3.4/dist-packages/websocket/_handshake.py", line 40, in
if six.PY34:

Is there any assistance in this matter as i'm not too practiced in python's pip system. Thank you

Most helpful comment

I just hit the same issue with the default Travis image (Trusty). The problem is that six.PY34 was only added in six 1.10.0 via https://github.com/benjaminp/six/commit/8a63b2e2b95f071023d9fb5d54f7c8a35ece9a93. Jessie ships with python3-six 1.8.0 while Ubuntu 14.04 Trusty ships with python3-six 1.5.2 which are too old.

I can fix it here by upgrading the travis image to Ubuntu 16.04 Xenial which includes python3-six 1.10.0, but perhaps setup.py could be enhanced with this caveat?

All 3 comments

Sorry, but I don't see what this has to do with docker-py, nothing you have posted is anything to do with it even if you end goal is to add docker-py to the mix. I think you should find a Python or pip support forum and use that.

Note however that docker-compose images are already available on Hub as docker/compose.

I'll highlight where in the logs this makes me see docker-py as the culprit:

File "/docker_api.py", line 4, in
import docker

Consequently there is a lack of clarity in requirements for this to run without extra setup.

I just hit the same issue with the default Travis image (Trusty). The problem is that six.PY34 was only added in six 1.10.0 via https://github.com/benjaminp/six/commit/8a63b2e2b95f071023d9fb5d54f7c8a35ece9a93. Jessie ships with python3-six 1.8.0 while Ubuntu 14.04 Trusty ships with python3-six 1.5.2 which are too old.

I can fix it here by upgrading the travis image to Ubuntu 16.04 Xenial which includes python3-six 1.10.0, but perhaps setup.py could be enhanced with this caveat?

Was this page helpful?
0 / 5 - 0 ratings