ImportError: No module named backports.ssl_match_hostname

Bug #1743231 reported by Chris West
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
docker-compose (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Confirmed
Undecided
Unassigned

Bug Description

When using upstream docker (i.e. docker-ce from download.docker.com, not docker 1.5 from Ubuntu), docker-compose dies with this ImportError. Looks like it was fixed upstream in March. Maybe docker-compose could be updated to a version that works with both in-box docker and upstream docker?

Upstream complaints:
 * https://github.com/docker/docker-py/issues/1502
 * https://stackoverflow.com/questions/43147387/docker-compose-gives-error-importerror-no-module-named-ssl-match-hostname-whe

I realise that you probably don't support having upstream docker installed, but it's probably the overwhelmingly common case.

Error:
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 11, 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 564, 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 2662, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2316, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2322, 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 24, in <module>
    from . import api
  File "/usr/lib/python2.7/dist-packages/docker/api/__init__.py", line 2, in <module>
    from .build import BuildApiMixin
  File "/usr/lib/python2.7/dist-packages/docker/api/build.py", line 9, in <module>
    from .. import utils
  File "/usr/lib/python2.7/dist-packages/docker/utils/__init__.py", line 1, in <module>
    from .utils import (
  File "/usr/lib/python2.7/dist-packages/docker/utils/utils.py", line 33, in <module>
    from .. import tls
  File "/usr/lib/python2.7/dist-packages/docker/tls.py", line 5, in <module>
    from .ssladapter import ssladapter
  File "/usr/lib/python2.7/dist-packages/docker/ssladapter/__init__.py", line 1, in <module>
    from .ssladapter import SSLAdapter # flake8: noqa
  File "/usr/lib/python2.7/dist-packages/docker/ssladapter/ssladapter.py", line 21, in <module>
    from backports.ssl_match_hostname import match_hostname
ImportError: No module named backports.ssl_match_hostname

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: docker-compose 1.8.0-2
ProcVersionSignature: Ubuntu 4.13.0-25.29-generic 4.13.13
Uname: Linux 4.13.0-25-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
Date: Sun Jan 14 14:53:20 2018
PackageArchitecture: all
SourcePackage: docker-compose
UpgradeStatus: Upgraded to artful on 2017-09-12 (124 days ago)

Revision history for this message
Chris West (faux) wrote :
Revision history for this message
Jason Pleau (jasonpleau) wrote :

Hi.

We investigated a similar issue in Debian [1]

Make sure you have this package installed:

https://packages.ubuntu.com/artful/python-backports.ssl-match-hostname

If you still get the error:

A temporary fix is to create an empty file called __init__.py in /usr/lib/python2.7/dist-packages/backports

Full filename: /usr/lib/python2.7/dist-packages/backports/__init__.py

1: see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=893520

Revision history for this message
Jeremy Bícha (jbicha) wrote :

This bug was fixed in the package docker-compose - 1.21.0-3

---------------
docker-compose (1.21.0-3) unstable; urgency=medium

  * Add dependency on python3-distutils.
    While part of stdlib, it is split in the Debian packaging.

 -- Felipe Sateler <email address hidden> Wed, 03 Oct 2018 14:55:03 -0300

docker-compose (1.21.0-2) unstable; urgency=medium

  [ Jason Pleau ]
  * Update Vcs-* fields to point to docker-compose-team group

  [ Felipe Sateler ]
  * Set team email as maintainer
  * Switch to using python3 instead of python2.
    Also removes the need for the ssl-match-hostname backport.
    (Closes: #909974)
  * Upload to unstable

 -- Felipe Sateler <email address hidden> Tue, 02 Oct 2018 16:49:34 -0300

docker-compose (1.21.0-1) experimental; urgency=medium

  [ Jason Pleau ]
  * New upstream release
  * Refresh patches
  * Bump Build-Dependencies
  * Add myself to Uploaders
  * Bump Standards-Version to 4.1.4
  * refresh Relax-dependencies.patch
  * Bump python-docker B-D to 3.2.1
  * add docker_compose.egg-info/* to debian/clean

 -- Felipe Sateler <email address hidden> Tue, 17 Apr 2018 20:02:23 -0300

Changed in docker-compose (Ubuntu):
status: New → Fix Released
Changed in docker-compose (Ubuntu Bionic):
status: New → Confirmed
tags: added: bionic
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.