Docker script docker-compose --version
is now throwing a weird error and is complaining about a missing python module ordered_dict
. Not sure why is this happening but previously it was working just fine. Not sure if its related but I installed pip
for python and later installed awscli
using the pip.
Below is the stack trace I get on running 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/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 484, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2725, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2343, in load
return self.resolve()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2349, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 14, in <module>
from . import errors
File "/usr/lib/python2.7/dist-packages/compose/cli/errors.py", line 9, in <module>
from docker.errors import APIError
File "/usr/lib/python2.7/dist-packages/docker/__init__.py", line 20, in <module>
from .client import Client, AutoVersionClient, from_env # flake8: noqa
File "/usr/lib/python2.7/dist-packages/docker/client.py", line 18, in <module>
import requests
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 58, in <module>
from . import utils
File "/usr/lib/python2.7/dist-packages/requests/utils.py", line 26, in <module>
from .compat import parse_http_list as _parse_list_header
File "/usr/lib/python2.7/dist-packages/requests/compat.py", line 42, in <module>
from .packages.urllib3.packages.ordered_dict import OrderedDict
ImportError: No module named ordered_dict
do it by installing urllib3 version 1.22 and uninstall the previous urllib3 verion by executing the following command in the shell
pip uninstall urllib3
pip install urllib3==1.22
Reinstalling docker-compose did the trick for me. You can reinstall by deleting the docker-compose
file from /usr/local/bin
and installing it again using instructions provided here.
You need to re-install.
Below are the steps that worked for me on Ubuntu 18.04
Re-installation steps:
First remove the installed docker-compose binaries:
sudo rm -r /usr/bin/docker-compose
sudo rm -r /usr/local/bin/docker-compose
Installation:
cd ~/
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
You can read more here: https://docs.docker.com/compose/install/#install-compose
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With