I am trying to install and use docker-compose for the first time on my Ubuntu 14.04 machine, but I am failing :))
I have installed docker-compose via pip using
When I try to run docker-compose up
I get this error trace:
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 41, in <module>
from . import errors
File "/usr/local/lib/python2.7/dist-packages/compose/cli/errors.py", line 10, in <module>
from docker.errors import APIError
File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py", line 2, in <module>
from .api import APIClient
File "/usr/local/lib/python2.7/dist-packages/docker/api/__init__.py", line 2, in <module>
from .client import APIClient
File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 11, in <module>
from .build import BuildApiMixin
File "/usr/local/lib/python2.7/dist-packages/docker/api/build.py", line 9, in <module>
from .. import utils
File "/usr/local/lib/python2.7/dist-packages/docker/utils/__init__.py", line 2, in <module>
from .utils import (
File "/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py", line 19, in <module>
from .. import tls
File "/usr/local/lib/python2.7/dist-packages/docker/tls.py", line 5, in <module>
from .transport import SSLAdapter
File "/usr/local/lib/python2.7/dist-packages/docker/transport/__init__.py", line 3, in <module>
from .ssladapter import SSLAdapter
File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 22, in <module>
urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
Eggs versions:
$pip freeze | grep -e urllib3 -e requests -e docker-py
docker-pycreds==0.2.1
requests==2.13.0
urllib3==1.14
I tried to export PYTHONPATH like this:
export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
I guess you have more than one packages with different version.
request and urllib3 can both exist in /usr/lib/python2.7/dist-packages/
and /usr/local/lib/python2.7/dist-packages
In ssladapter.py, request.packages.urllib3 is priorly imported according: try: import requests.packages.urllib3 as urllib3 except ImportError: import urllib3
If your requests.packages.urllib3 is too old, error will be raised.
So you have two ways to fix this problem
copy the newest urllib3 into requests/packages
remove the urllib3 in requests/packages so that docker-compose will use the urllib3 from pythonpath (your latest urllib3)
(You can get the path of requests by the interactive console:
>>> import requests
>>> requests
<module 'requests' from '/usr/lib/python2.7/dist-packages/requests/__init__.pyc'>
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.