2

I'm writing a script which will build the docker image and then push the image to ECR. my current python version is

>python --version
Python 3.8.0

so, for some reason, at the first line while running my python at local, I'm getting below error. Saying this means, it has not yet build the image to push into the ECR.

import docker --> throws below error

Traceback (most recent call last):
  File "genericECR.py", line 1, in <module>
    import docker
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\docker\__init__.py", line 2, in <module>
    from .api import APIClient
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\docker\api\__init__.py", line 2, in <module>
    from .client import APIClient
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\docker\api\client.py", line 8, in <module>
    import websocket
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\__init__.py", line 23, in <module>
    from ._app import WebSocketApp
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\_app.py", line 36, in <module>
    from ._core import WebSocket, getdefaulttimeout
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\_core.py", line 34, in <module>
    from ._handshake import *
  File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\_handshake.py", line 40, in <module>
    if six.PY34:
AttributeError: module 'six' has no attribute 'PY34'

six is already installed

Requirement already satisfied: six in c:\users\appdata\local\programs\python\python38-32\lib\site-packages (1.6.1)

it seems like it is intended for python 34 so for python 38, how can I solve this?

change198
  • 1,647
  • 3
  • 21
  • 60

2 Answers2

4

Most probably the six version is not high enough, c.f. https://github.com/docker/docker-py/issues/2294

First check the six version:

import six
print(six.__version__)

If six version is not >=1.0.0, then upgrade six, on command line

python -m pip install -U six

With the latest pip, you should see this:

>>> import six
>>> six.__version__
'1.13.0'
>>> six.PY34
True
alvas
  • 115,346
  • 109
  • 446
  • 738
  • you are right, I had version 1.6.1. It had another python package dependency. So when I upgrade the six, I received ERROR: pystreams 0.6 has requirement six==1.6.1, but you'll have six 1.13.0 which is incompatible. But anyway, after the upgrade It is working. Thanks again. – change198 Dec 17 '19 at 10:57
  • Ouch `streams` looks painfully outdated, https://github.com/9seconds/streams 3-6 years without new commits. You shouldn't depend on that if it's not necessary =) – alvas Dec 17 '19 at 11:00
1

it helped, I was having the issue with docker-compose running, that command helped: python -m pip install -U six

  • welcome to Stack Overflow. Instead of thank you posts it is better to upvote the answer that actually helped you. (this way also other user see on a glance, which solution to try) – Steffen Moritz Jul 17 '20 at 22:57