Compose: ImportError: cannot import name LogConfig

Created on 18 Jun 2015  路  10Comments  路  Source: docker/compose

no matter what I run, LogConfig cannot be imported. This affects the 1.3.0 release coming from pypi.

I've confirmed this on multiple Ubuntu 14.04 hosts

ImportError: cannot import name LogConfig

The known fix was to downgrade back to the 1.2.x series, eg: pip install docker-compose==1.2.0

Most helpful comment

@lazize try pip install --upgrade docker-py

All 10 comments

Can you paste the output of pip list?

LogConfig was added to docker-py in 1.2.0 (https://github.com/docker/docker-py/commit/21d80b16ddb67b1d95b62b56dad1b91a7986333f), and compose depends on docker-py >= 1.2.3 so it should have been installed along with compose.

closing, no response from OP

This would be fixed with a docker-py upgrade

Hi,

I know it is closed and it was a long time ago.
But suddenly I start to get the error below. I am not sure if it is exactly related with this issue, if you want I can open a new one.

$ docker-compose up
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 9, in <module>
    load_entry_point('docker-compose==1.5.2', 'console_scripts', 'docker-compose')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 22, in <module>
    from ..project import NoSuchService
  File "/usr/lib/python2.7/dist-packages/compose/project.py", line 18, in <module>
    from .service import ContainerNet
  File "/usr/lib/python2.7/dist-packages/compose/service.py", line 13, in <module>
    from docker.utils import LogConfig
ImportError: cannot import name LogConfig

Below is the pip list result:

$ sudo -H pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
adium-theme-ubuntu (0.3.4)
ansible (2.2.1.0)
awscli (1.11.44)
backports.ssl-match-hostname (3.5.0.1)
BeautifulSoup (3.2.1)
beautifulsoup4 (4.4.1)
boto3 (1.4.4)
botocore (1.5.7)
chardet (2.3.0)
colorama (0.3.7)
cryptography (1.2.3)
docker (2.1.0)
docker-compose (1.5.2)
docker-py (1.8.0)
docker-pycreds (0.2.1)
dockerpty (0.3.4)
docopt (0.6.2)
docutils (0.13.1)
ecdsa (0.13)
enum34 (1.1.2)
funcsigs (0.4)
functools32 (3.2.3.post2)
futures (3.0.5)
html5lib (0.999)
httplib2 (0.9.1)
idna (2.0)
ipaddress (1.0.16)
Jinja2 (2.8)
jmespath (0.9.1)
jsonschema (2.5.1)
logconfig (0.4.0)
logutils (0.3.4.1)
lxml (3.5.0)
MarkupSafe (0.23)
mock (1.3.0)
ndg-httpsclient (0.4.0)
paramiko (1.16.0)
pbr (1.8.0)
pip (9.0.1)
pyasn1 (0.1.9)
pycrypto (2.6.1)
pyOpenSSL (0.15.1)
python-dateutil (2.6.0)
pytz (2016.10)
PyYAML (3.11)
requests (2.9.1)
rsa (3.4.2)
s3transfer (0.1.10)
setuptools (20.7.0)
six (1.10.0)
texttable (0.8.1)
tzlocal (1.3)
unity-lens-photos (1.0)
urllib3 (1.13.1)
websocket-client (0.40.0)
wheel (0.29.0)
xmltodict (0.10.2)

@lazize try pip install --upgrade docker-py

I still get the same error with docker-py-1.10.6 and pip 9.0.1

Output of docker-compose --version:
docker-compose --version Traceback (most recent call last): File "/usr/bin/docker-compose", line 9, in <module> load_entry_point('docker-compose==1.8.0', 'console_scripts', 'docker-compose')() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point return ep.load() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load return self.resolve() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2235, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 17, in <module> from ..bundle import get_image_digests File "/usr/lib/python2.7/dist-packages/compose/bundle.py", line 14, in <module> from .service import format_environment File "/usr/lib/python2.7/dist-packages/compose/service.py", line 13, in <module> from docker.utils import LogConfig ImportError: cannot import name LogConfig

@dissnn Thanks for your message. I already solved the problem before your message, so I can't tell you if this will solve the problem.

As it was a quite some time ago I don't recover exactly, but I solved it trying to updating all my packages, when I did that I showed me that some package was in conflict because of two different version, so I removed it and reinstalled again. After that everything was fine.

I was running docker-compose 1.8.x (default when installed on ubuntu 16.04).
I was able to get rid of the problem by installing docker-compose 1.11.2

Installation of the correct/latest version of docker-py, as @brucellino suggested in docker-compose requires logconfig #999, works for me.

pip install docker-py==1.10.6a1

@dissnn Thanks. That worked!

Was this page helpful?
0 / 5 - 0 ratings