2021-01-12 10:15

Breaking change for docker-py with release of pypiwin32 (222) (Windows only)

On Windows there appears to be a breaking change with the release of version 222 of pypiwin32 https://pypi.python.org/pypi/pypiwin32

This breaks on Python 2.7.14 and Python 3.x.

Call stack:

Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> client = docker.DockerClient.from_env()
Traceback (most recent call last):
  File "<path>\AppData\Local\conda\conda\envs\py3\lib\site-packages\docker\api\client.py", line 126, in __init__
    self._custom_adapter = NpipeAdapter(
NameError: name 'NpipeAdapter' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<path>\AppData\Local\conda\conda\envs\py3\lib\site-packages\docker\client.py", line 81, in from_env
  File "<path>\AppData\Local\conda\conda\envs\py3\lib\site-packages\docker\client.py", line 38, in __init__
    self.api = APIClient(*args, **kwargs)
  File "<path>\AppData\Local\conda\conda\envs\py3\lib\site-packages\docker\api\client.py", line 131, in __init__
    'Install pypiwin32 package to enable npipe:// support'
docker.errors.DockerException: Install pypiwin32 package to enable npipe:// support

Installed Packages:

$> pip list
asn1crypto (0.24.0)
certifi (2018.1.18)
cffi (1.11.4)
chardet (3.0.4)
cryptography (2.1.4)
docker (2.6.0)
docker-pycreds (0.2.1)
enum34 (1.1.6)
idna (2.6)
pip (9.0.1)
pycparser (2.18)
pyOpenSSL (17.5.0)
pypiwin32 (222)
pywin32 (222)
requests (2.18.4)
setuptools (38.4.0)
six (1.11.0)
urllib3 (1.22)
websocket-client (0.46.0)
wheel (0.30.0)
wincertstore (0.2)

Quick pointers: Per win32-requirements.txt the minimum version specified is 219. When using pypiwin32 219 on Python 3.6.4 we see the error below. However release 220 works fine on both Python 2.7 and 3.6. So this file might have to modified.

Collecting pypiwin32==219
  Using cached pypiwin32-219.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\devel\AppData\Local\Temp\pip-build-e_pjyvg3\pypiwin32\setup.py", line 121
        print "Building pywin32", pywin32_version
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Building pywin32", pywin32_version)?

This can easily affect a lot of users very quickly, so any fixes to address the issue or a quick win32-requirements.txt patch would be appreciated.


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享