Compose: ImportError: cannot import name IPAMConfig

Created on 29 Jan 2017  路  9Comments  路  Source: docker/compose

I get this error after type docker-compose --version. I've installed docker-compose with pip

$ docker-compose --version
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/dist-packages/compose/cli/main.py", line 20, in <module>
    from ..bundle import get_image_digests
  File "/usr/local/lib/python2.7/dist-packages/compose/bundle.py", line 13, in <module>
    from .network import get_network_defs_for_service
  File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 7, in <module>
    from docker.types import IPAMConfig
ImportError: cannot import name IPAMConfig
duplicate

Most helpful comment

May be there is a bug, I use this workaround by @jpiron
https://github.com/ansible/ansible/issues/20492

pip uninstall docker
pip uninstall docker-py
pip uninstall docker-compose
pip install docker-compose==1.9.0

All 9 comments

I also get similar error:
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/dist-packages/compose/cli/main.py", line 20, in <module> from ..bundle import get_image_digests File "/usr/local/lib/python2.7/dist-packages/compose/bundle.py", line 13, in <module> from .network import get_network_defs_for_service File "/usr/local/lib/python2.7/dist-packages/compose/network.py", line 7, in <module> from docker.types import IPAMConfig File "/usr/local/lib/python2.7/dist-packages/docker/types/__init__.py", line 5, in <module> from .services import ( File "/usr/local/lib/python2.7/dist-packages/docker/types/services.py", line 5, in <module> from ..utils import format_environment, split_command ImportError: cannot import name format_environment

Same problem. Any workaround?

May be there is a bug, I use this workaround by @jpiron
https://github.com/ansible/ansible/issues/20492

pip uninstall docker
pip uninstall docker-py
pip uninstall docker-compose
pip install docker-compose==1.9.0

Same issue as #4344

Thank @scne

Solution of scne (of Jan 30, 2017) -- using docker-compose==1.9.0 work for me. The other solution on the other page of Issue #4344 (here on Jan 17, 2017) using docker==2.0.1 did not work for me.

May be there is a bug, I use this workaround by @jpiron
ansible/ansible#20492

pip uninstall docker
pip uninstall docker-py
pip uninstall docker-compose
pip install docker-compose==1.9.0

changed last install step( removing version) and it worked

not an solution if you want a recent docker-compose though, just installed the static version via https://docs.docker.com/compose/install/

May be there is a bug, I use this workaround by @jpiron
ansible/ansible#20492

pip uninstall docker
pip uninstall docker-py
pip uninstall docker-compose
pip install docker-compose==1.9.0

Uninstalling docker-py with pip solved the issue for me already.

Was this page helpful?
0 / 5 - 0 ratings