What to do if an error occurs due to urllib3 in Check! docker-compose

Good evening, this is Kazumi Ohira, also known as @dz_.

Prologue-Introduction

After updating vagrant's ʻubuntu / trusty64`, docker-compose used in vagrant stopped working, so I fixed it. It is the memorandum.

error contents

When I tried to use docker-compose, I got the following python error.

Error excerpt

vagrant@vagrant-ubuntu-trusty-64:~$ docker-compose --help

  ... <Abbreviation> ...

  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'

Occurrence environment

#Check docker related version of python
vagrant@vagrant-ubuntu-trusty-64:~$ pip freeze | grep docker
docker==2.0.2
docker-compose==1.10.1
docker-pycreds==0.2.1
dockerpty==0.4.1

#Check Docker version
vagrant@vagrant-ubuntu-trusty-64:~$ docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:50:17 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:50:17 2017
 OS/Arch:      linux/amd64
 Experimental: false

Investigation

Looking at this article, it seems that the version of python ʻurllib3 doesn't match. The latest version of ʻurllib3 is 1.20, but for some reason 1.7.1 was included.

Upon further investigation, as pointed out in this issue, python-urllib3 installed by ʻapt-get was 1.7.1`.

#Check the urllib3 version of python
vagrant@vagrant-ubuntu-trusty-64:~$ pip freeze | grep urllib3
urllib3==1.7.1

# apt-python installed with get-Check the version of urllib3
vagrant@vagrant-ubuntu-trusty-64:~$ dpkg --list | grep urllib3
ii  python-urllib3                       1.7.1-1ubuntu4                      all          HTTP library with thread-safe connection pooling for Python
ii  python-urllib3-whl                   1.7.1-1ubuntu4                      all          HTTP library with thread-safe connection pooling

But ...

Simply installing with pip install urllib3 = 1.20 did not work because docker looked towards 1.7.1. So, if you remove it with ʻapt-get remove python-urllib3 python-urllib3-whl, docker will work, but this time pipwill be uninstalled together ..., this is no good (´ ・ ω) ・)

Conclusion

I wanted to use docker-compose inside vagrant at this time. There are two likely ways to achieve this.

One would be to remove python-urllib3 * from ʻapt-getand installpip with get-pip.py instead of ʻapt-get.

And the other was to upgrade the version of Ubuntu.

The reason is that python-urllib3 installed by ʻubuntu / trusty (14.04)seems to be1.7.1-1build1, but python-urllib3 installed by ʻubuntu / xenial (16.04) It seems thatis 1.13.1-2.

So I got things done by updating Ubuntu to 16.04! !!

(Even in Ubuntu 16.04, ʻurllib3` is not the latest version, but there was no problem using docker-compose.)

Epilogue-Conclusion

It may be an error with a limited environment, but I hope it helps someone m (_ _) m

Recommended Posts

What to do if an error occurs due to urllib3 in Check! docker-compose
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if an error occurs when importing numpy with VScode
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do if a UnicodeDecodeError occurs in pip
[python] What to do when an error occurs in send_keys of headless chrome
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do if a version error occurs in the selenium Chrome driver
What to do if an error occurs in TensorFlow RNN related import or RNN (LSTM) Cell (v 0.11r ~)
What to do when an error occurs with import _ssl
What to do if the print command itself causes an error in Maya python
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you run python in IntelliJ and end with an error
[Beanstalk] What to do when an error occurs with import uuid
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do if you get an error saying c compiler cannot create executables in configure
What to do if pyenv install does not proceed with an error
What to do if you get an error when trying to load mnist
What to do if pip --user returns an error in a virtual environment created with pyenv
What to do if PyInstaller3.5 gives an error in Python3.8 (TypeError: an integer is required (got type bytes))
[Django] What to do if an Integrity Error occurs when registering data from the management site to the database
What to do if a symbolic link error occurs in import cv while trying to install OpenCV in Python
What to do when SSL error occurs in pip in Windows10, miniconda, VScode environment
What to do if you get an error when installing python with pyenv
What to do if an error occurs when loading a python project created with poetry into VS Code
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if pip gives a DistributionError in Homebrew
What to do when a Remove Error occurs when updating conda
What to do if you get "coverage unknown" in Coveralls
How to check if a value exists in an enum
What to do if you can't log in as root
What to do if a communication error occurs due to proxy when installing with package management of pip, npm, gem
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if ʻObject arrays cannot be loaded when allow_pickle = False` occurs in numpy.load ()
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if Fatal Python error: Py_Initialize: can't initialize sys standard streams LookupError: unknown encoding: windows-31j occurs in PyCharm
[Note] Items to check when an infinite loop occurs in pyenv
What to do if "Unnamed: 0" is added in to_csv-> read_csv in pandas
What to do if you can't use the trash in Lubuntu 18.04.
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ())
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if an error message "There was a problem displaying this web page" is displayed in Chrome's Web Driver (Selenium)
What to do if your disk runs out due to MySQL binary logs
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if No Python documentation found for ... appears in pydoc
[Python] What to do when an error related to SSL authentication is returned
What to do if you can't install with pip in babun environment
What to do when psycopg2 throws an error when pipenv lock under Pipenv environment
What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if rails s doesn't work
What to do if Django can't load an image from a static folder
If an exception occurs in the function, it will be transmitted to the caller 2
What to do when PermissionError of tempfile.mkstemp occurs
What to do if you get "Python not configured." Using PyDev in Eclipse
[Python] What to check when you get a Unicode Decode Error in Django
What to do if atom autocomplete-python doesn't work