docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.93k stars 5.21k forks source link

docker-compose doesn't run with python3 #2097

Closed bjcubsfan closed 9 years ago

bjcubsfan commented 9 years ago

I used conda to set up a python environment with both python 2 and python 3:

conda create -n docker python=3 pip
conda create -n docker2 python=2 pip

I pip installed docker compose in each environment:

pip install docker-compose

The docker-compose command works in the python2 environment, but not in the python3 environment. It also does not work in my native python3 environment on Arch Linux. It throws an error about the 'Queue' package. I think you could use the python six module to make this work with both python2 and python3. Here's the error that was thrown:

(docker)bpotter@lore➜ code/tools/status_web(status_web_compose☢ )» docker-compose         [13:19:17]
Traceback (most recent call last):
  File "/home/bpotter/miniconda3/envs/docker/bin/docker-compose", line 7, in <module>
    from compose.cli.main import main
  File "/home/bpotter/miniconda3/envs/docker/lib/python3.5/site-packages/compose/cli/main.py", line 16, in <module>
    from ..project import NoSuchService, ConfigurationError
  File "/home/bpotter/miniconda3/envs/docker/lib/python3.5/site-packages/compose/project.py", line 12, in <module>
    from .service import ContainerNet
  File "/home/bpotter/miniconda3/envs/docker/lib/python3.5/site-packages/compose/service.py", line 28, in <module>
    from .utils import json_hash, parallel_execute
  File "/home/bpotter/miniconda3/envs/docker/lib/python3.5/site-packages/compose/utils.py", line 8, in <module>
    from Queue import Queue, Empty
ImportError: No module named 'Queue'
dnephin commented 9 years ago

We run our tests against python3. master supports python3, and the support will be in the next release (1.5.0).

The version up on pypi is of the latest release which doesn't yet support python3.

You can pip install master with this command:

pip install git+git://github.com/docker/compose.git@master
bjcubsfan commented 9 years ago

OK, thanks

lelit commented 9 years ago

The problem is still present in current 1.5.0rc3. Does that mean that support for Python 3 has been postponed?

dnephin commented 9 years ago

Python 3 support is in 1.5.0. Could you paste the stack trace you're seeing?

lelit commented 9 years ago

Uhm, I was tricked by the fact that by default pip installs only stable versions. I shall pin the exact version of docker-compose in my requirements.txt file, or use pip install --pre. Thank you and sorry for the noise.