Docker-py: websocket-client dependency range isn't compatible with newly released 1.0.0

Created on 18 May 2021  路  2Comments  路  Source: docker/docker-py

When doing a pip install with a fresh venv it installs websocket-client 1.0.0 due to the websocket-client>=0.32.0 requirement.

requirements.txt

docker==5.0.0

test.py

import docker

Running python test.py gives the following error

Traceback (most recent call last):
  File "test_failing_docker_sdk.py", line 1, in <module>
    import docker
  File "/projects/myproj/src/main/python/env/lib/python3.6/site-packages/docker/__init__.py", line 2, in <module>
    from .api import APIClient
  File "/projects/myproj/src/main/python/env/lib/python3.6/site-packages/docker/api/__init__.py", line 2, in <module>
    from .client import APIClient
  File "/projects/myproj/src/main/python/env/lib/python3.6/site-packages/docker/api/client.py", line 10, in <module>
    from .. import auth
  File "/projects/myproj/src/main/python/env/lib/python3.6/site-packages/docker/auth.py", line 5, in <module>
    import six
ModuleNotFoundError: No module named 'six'

logs when installing with pip

Collecting websocket-client>=0.32.0 (from docker==5.0.0->-r requirements.txt (line 2))
  Using cached https://files.pythonhosted.org/packages/ba/d1/501076b54481412df1bc4cdd1fe479f66e17857c63ec5981bedcdc2ca793/websocket_client-1.0.0-py2.py3-none-any.whl
$  pip freeze && python --version && docker version
certifi==2020.12.5
chardet==4.0.0
docker==5.0.0
idna==2.10
requests==2.25.1
urllib3==1.26.4
websocket-client==1.0.0
Python 3.6.8
Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:21:11 2020
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683
  ```

  dependency tree using `pipdeptree` that shows docker required >=0.32.0

$ pipdeptree
docker==5.0.0

  • requests [required: >=2.14.2,!=2.18.0, installed: 2.25.1]

    • certifi [required: >=2017.4.17, installed: 2020.12.5]

    • chardet [required: >=3.0.2,<5, installed: 4.0.0]

    • idna [required: >=2.5,<3, installed: 2.10]

    • urllib3 [required: >=1.21.1,<1.27, installed: 1.26.4]

  • websocket-client [required: >=0.32.0, installed: 1.0.0]
    pipdeptree==2.0.0
  • pip [required: >=6.0.0, installed: 18.1]
    setuptools==40.6.2
my current workaround is to limit the range of `websocket-client` in my requirements.txt

docker==5.0.0
websocket-client>=0.32.0,<1
```

Most helpful comment

Ran into a similar problem yesterday when trying to install on a CentOS7 box where I'm forced to use python 2.7.5, therefore restricted to version 4.4.4 of the docker library.
Only work-around I've found is to explicitly install the websocket-client dependency with a <1 argument prior to installing docker.
Is there any chance of getting a 4.4.5 release of the docker library to support those of stuck in the last decade?

I know it's a long shot, but it would be incredibly helpful, there are lots of places e.g. the ansible docker community collection where we're told to explicitly use version 4.4.4 of the docker library on systems running python 2.7 and currently all of that documentation is incorrect due to this dependency issue.

All 2 comments

This isn't really related to the websocket-client changes, but due to docker not properly tracking its dependencies and relying on another package to pull them in. The change to setup.py should be to explicitly include the six dependency.

Ran into a similar problem yesterday when trying to install on a CentOS7 box where I'm forced to use python 2.7.5, therefore restricted to version 4.4.4 of the docker library.
Only work-around I've found is to explicitly install the websocket-client dependency with a <1 argument prior to installing docker.
Is there any chance of getting a 4.4.5 release of the docker library to support those of stuck in the last decade?

I know it's a long shot, but it would be incredibly helpful, there are lots of places e.g. the ansible docker community collection where we're told to explicitly use version 4.4.4 of the docker library on systems running python 2.7 and currently all of that documentation is incorrect due to this dependency issue.

Was this page helpful?
0 / 5 - 0 ratings