Compose: splitdrive import issue on docker-compose==1.16.0

Created on 1 Sep 2017  路  8Comments  路  Source: docker/compose

Using Python 2.7.5 with docker-compose==1.16.0 through pip install --upgrade docker-compose==1.16.0

Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from compose.utils import splitdrive
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/compose/utils.py", line 15, in <module>
    from .config.errors import ConfigurationError
  File "/usr/lib/python2.7/site-packages/compose/config/__init__.py", line 6, in <module>
    from .config import ConfigurationError
  File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 15, in <module>
    from . import types
  File "/usr/lib/python2.7/site-packages/compose/config/types.py", line 17, in <module>
    from compose.utils import splitdrive

Whereas using docker-compose==1.15.0 through pip install --upgrade docker-compose==1.15.0

(tested using docker-compose==1.15.0 and docker-compose==1.14.0 both are working)

Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from compose.utils import splitdrive
>>>

PS: I'm not using docker-compose python by myself, but it used by _Ansible_ docker-service module and with docker-compose==1.16.0 I got that message

"msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: cannot import name splitdrive"
kinenhancement

Most helpful comment

For those in Ansible land, this issue does not manifest in devel or the 2.4 rc's. So either limit yourself to Docker Compose <1.16 or upgrade from Ansible 2.3.x into 2.4/devel.

All 8 comments

As I said before, we make no guarantee of a stable API for developers attempting to use Compose as a library.

For those of you who are trying to use boot2docker image (docker-machine, Tiny Core Linux) on macos with ansible through its docker module... Downgrade docker-compose pip library to 1.9.0.

If you're only downgrading to 1.15.0, you'll hit #4401.

@shin- This isn't about importing from Ansible, I don't think. That traceback is a circular import. Importing compose.utils begins an import series that breaks when it tries to import compose.utils again. Looking to see if I can identify the breaking change....

The import that kicks off the chain was introduced recently: https://github.com/docker/compose/commit/6e802df80948696739d6aaf721d8bcf8c3bbe6a1#diff-7345a7e448db63ef1a5b786900e2b7b4R15

For those in Ansible land, this issue does not manifest in devel or the 2.4 rc's. So either limit yourself to Docker Compose <1.16 or upgrade from Ansible 2.3.x into 2.4/devel.

I'm aware it is a circular import. It just does not affect the software when used as intended. I'll work on a fix when I return from vacation. Thank you for your patience.

Enjoy your time off! Thanks!

Thank you!

Was this page helpful?
0 / 5 - 0 ratings