We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
docker-py installation breaks docker-compose
im not quite sure if this is correct, but trying to install `docker-py` through pip after i've installed `docker-compose` breaks `docker-compose` with

```
Traceback (most recent call last):
  File "/usr/local/bin/docker-compose", line 7, in <module>
    from compose.cli.main import main
  File "/usr/local/lib/python2.7/site-packages/compose/cli/main.py", line 20, in <module>
    from ..bundle import get_image_digests
  File "/usr/local/lib/python2.7/site-packages/compose/bundle.py", line 13, in <module>
    from .network import get_network_defs_for_service
  File "/usr/local/lib/python2.7/site-packages/compose/network.py", line 7, in <module>
    from docker.types import IPAMConfig
ImportError: cannot import name IPAMConfig
```

To fix that error, i just need to do the installations in this order:
```
pip install docker-py
pip install docker-compose
```


gist:
https://gist.github.com/serialdoom/3a443c420aa29f9422f8c5fc73f46602

python/pip versions tried:
```
docker run -it python:2.7.13 bash -c 'pip --version'
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
docker run -it python:2.7.12 bash -c 'pip --version'
pip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 import codecs
3 import os
4 import sys
5 
6 from setuptools import setup, find_packages
7 
8 
9 ROOT_DIR = os.path.dirname(__file__)
10 SOURCE_DIR = os.path.join(ROOT_DIR)
11 
12 requirements = [
13     'requests >= 2.5.2, != 2.11.0, != 2.12.2',
14     'six >= 1.4.0',
15     'websocket-client >= 0.32.0',
16     'docker-pycreds >= 0.2.1'
17 ]
18 
19 if sys.platform == 'win32':
20     requirements.append('pypiwin32 >= 219')
21 
22 extras_require = {
23     ':python_version < "3.5"': 'backports.ssl_match_hostname >= 3.5',
24     # While not imported explicitly, the ipaddress module is required for
25     # ssl_match_hostname to verify hosts match with certificates via
26     # ServerAltname: https://pypi.python.org/pypi/backports.ssl_match_hostname
27     ':python_version < "3.3"': 'ipaddress >= 1.0.16',
28 }
29 
30 version = None
31 exec(open('docker/version.py').read())
32 
33 with open('./test-requirements.txt') as test_reqs_txt:
34     test_requirements = [line for line in test_reqs_txt]
35 
36 
37 long_description = ''
38 try:
39     with codecs.open('./README.rst', encoding='utf-8') as readme_rst:
40         long_description = readme_rst.read()
41 except IOError:
42     # README.rst is only generated on release. Its absence should not prevent
43     # setup.py from working properly.
44     pass
45 
46 setup(
47     name="docker",
48     version=version,
49     description="A Python library for the Docker Engine API.",
50     long_description=long_description,
51     url='https://github.com/docker/docker-py',
52     packages=find_packages(exclude=["tests.*", "tests"]),
53     install_requires=requirements,
54     tests_require=test_requirements,
55     extras_require=extras_require,
56     zip_safe=False,
57     test_suite='tests',
58     classifiers=[
59         'Development Status :: 5 - Production/Stable',
60         'Environment :: Other Environment',
61         'Intended Audience :: Developers',
62         'Operating System :: OS Independent',
63         'Programming Language :: Python',
64         'Programming Language :: Python :: 2',
65         'Programming Language :: Python :: 2.7',
66         'Programming Language :: Python :: 3',
67         'Programming Language :: Python :: 3.3',
68         'Programming Language :: Python :: 3.4',
69         'Programming Language :: Python :: 3.5',
70         'Topic :: Utilities',
71         'License :: OSI Approved :: Apache Software License',
72     ],
73     maintainer='Joffrey F',
74     maintainer_email='joffrey@docker.com',
75 )
76
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,20 @@
 #!/usr/bin/env python
+from __future__ import print_function
+
 import codecs
 import os
 import sys
 
+import pip
+
 from setuptools import setup, find_packages
 
+if 'docker-py' in [x.project_name for x in pip.get_installed_distributions()]:
+    print(
+        'ERROR: "docker-py" needs to be uninstalled before installing this'
+        ' package:\npip uninstall docker-py', file=sys.stderr
+    )
+    sys.exit(1)
 
 ROOT_DIR = os.path.dirname(__file__)
 SOURCE_DIR = os.path.join(ROOT_DIR)

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -1,10 +1,20 @@\n #!/usr/bin/env python\n+from __future__ import print_function\n+\n import codecs\n import os\n import sys\n \n+import pip\n+\n from setuptools import setup, find_packages\n \n+if 'docker-py' in [x.project_name for x in pip.get_installed_distributions()]:\n+    print(\n+        'ERROR: \"docker-py\" needs to be uninstalled before installing this'\n+        ' package:\\npip uninstall docker-py', file=sys.stderr\n+    )\n+    sys.exit(1)\n \n ROOT_DIR = os.path.dirname(__file__)\n SOURCE_DIR = os.path.join(ROOT_DIR)\n", "issue": "docker-py installation breaks docker-compose\nim not quite sure if this is correct, but trying to install `docker-py` through pip after i've installed `docker-compose` breaks `docker-compose` with\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/usr/local/bin/docker-compose\", line 7, in <module>\r\n    from compose.cli.main import main\r\n  File \"/usr/local/lib/python2.7/site-packages/compose/cli/main.py\", line 20, in <module>\r\n    from ..bundle import get_image_digests\r\n  File \"/usr/local/lib/python2.7/site-packages/compose/bundle.py\", line 13, in <module>\r\n    from .network import get_network_defs_for_service\r\n  File \"/usr/local/lib/python2.7/site-packages/compose/network.py\", line 7, in <module>\r\n    from docker.types import IPAMConfig\r\nImportError: cannot import name IPAMConfig\r\n```\r\n\r\nTo fix that error, i just need to do the installations in this order:\r\n```\r\npip install docker-py\r\npip install docker-compose\r\n```\r\n\r\n\r\ngist:\r\nhttps://gist.github.com/serialdoom/3a443c420aa29f9422f8c5fc73f46602\r\n\r\npython/pip versions tried:\r\n```\r\ndocker run -it python:2.7.13 bash -c 'pip --version'\r\npip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)\r\ndocker run -it python:2.7.12 bash -c 'pip --version'\r\npip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7)\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\nimport codecs\nimport os\nimport sys\n\nfrom setuptools import setup, find_packages\n\n\nROOT_DIR = os.path.dirname(__file__)\nSOURCE_DIR = os.path.join(ROOT_DIR)\n\nrequirements = [\n    'requests >= 2.5.2, != 2.11.0, != 2.12.2',\n    'six >= 1.4.0',\n    'websocket-client >= 0.32.0',\n    'docker-pycreds >= 0.2.1'\n]\n\nif sys.platform == 'win32':\n    requirements.append('pypiwin32 >= 219')\n\nextras_require = {\n    ':python_version < \"3.5\"': 'backports.ssl_match_hostname >= 3.5',\n    # While not imported explicitly, the ipaddress module is required for\n    # ssl_match_hostname to verify hosts match with certificates via\n    # ServerAltname: https://pypi.python.org/pypi/backports.ssl_match_hostname\n    ':python_version < \"3.3\"': 'ipaddress >= 1.0.16',\n}\n\nversion = None\nexec(open('docker/version.py').read())\n\nwith open('./test-requirements.txt') as test_reqs_txt:\n    test_requirements = [line for line in test_reqs_txt]\n\n\nlong_description = ''\ntry:\n    with codecs.open('./README.rst', encoding='utf-8') as readme_rst:\n        long_description = readme_rst.read()\nexcept IOError:\n    # README.rst is only generated on release. Its absence should not prevent\n    # setup.py from working properly.\n    pass\n\nsetup(\n    name=\"docker\",\n    version=version,\n    description=\"A Python library for the Docker Engine API.\",\n    long_description=long_description,\n    url='https://github.com/docker/docker-py',\n    packages=find_packages(exclude=[\"tests.*\", \"tests\"]),\n    install_requires=requirements,\n    tests_require=test_requirements,\n    extras_require=extras_require,\n    zip_safe=False,\n    test_suite='tests',\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Other Environment',\n        'Intended Audience :: Developers',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Topic :: Utilities',\n        'License :: OSI Approved :: Apache Software License',\n    ],\n    maintainer='Joffrey F',\n    maintainer_email='joffrey@docker.com',\n)\n", "path": "setup.py"}], "after_files": [{"content": "#!/usr/bin/env python\nfrom __future__ import print_function\n\nimport codecs\nimport os\nimport sys\n\nimport pip\n\nfrom setuptools import setup, find_packages\n\nif 'docker-py' in [x.project_name for x in pip.get_installed_distributions()]:\n    print(\n        'ERROR: \"docker-py\" needs to be uninstalled before installing this'\n        ' package:\\npip uninstall docker-py', file=sys.stderr\n    )\n    sys.exit(1)\n\nROOT_DIR = os.path.dirname(__file__)\nSOURCE_DIR = os.path.join(ROOT_DIR)\n\nrequirements = [\n    'requests >= 2.5.2, != 2.11.0, != 2.12.2',\n    'six >= 1.4.0',\n    'websocket-client >= 0.32.0',\n    'docker-pycreds >= 0.2.1'\n]\n\nif sys.platform == 'win32':\n    requirements.append('pypiwin32 >= 219')\n\nextras_require = {\n    ':python_version < \"3.5\"': 'backports.ssl_match_hostname >= 3.5',\n    # While not imported explicitly, the ipaddress module is required for\n    # ssl_match_hostname to verify hosts match with certificates via\n    # ServerAltname: https://pypi.python.org/pypi/backports.ssl_match_hostname\n    ':python_version < \"3.3\"': 'ipaddress >= 1.0.16',\n}\n\nversion = None\nexec(open('docker/version.py').read())\n\nwith open('./test-requirements.txt') as test_reqs_txt:\n    test_requirements = [line for line in test_reqs_txt]\n\n\nlong_description = ''\ntry:\n    with codecs.open('./README.rst', encoding='utf-8') as readme_rst:\n        long_description = readme_rst.read()\nexcept IOError:\n    # README.rst is only generated on release. Its absence should not prevent\n    # setup.py from working properly.\n    pass\n\nsetup(\n    name=\"docker\",\n    version=version,\n    description=\"A Python library for the Docker Engine API.\",\n    long_description=long_description,\n    url='https://github.com/docker/docker-py',\n    packages=find_packages(exclude=[\"tests.*\", \"tests\"]),\n    install_requires=requirements,\n    tests_require=test_requirements,\n    extras_require=extras_require,\n    zip_safe=False,\n    test_suite='tests',\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Environment :: Other Environment',\n        'Intended Audience :: Developers',\n        'Operating System :: OS Independent',\n        'Programming Language :: Python',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Topic :: Utilities',\n        'License :: OSI Approved :: Apache Software License',\n    ],\n    maintainer='Joffrey F',\n    maintainer_email='joffrey@docker.com',\n)\n", "path": "setup.py"}]}