question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'module' object has on attribute 'connection'

See original GitHub issue

run on ubuntu 3.19.0-23-generic #24~14.04.1-Ubuntu docker-py version 1.8.1 and 1.8.0 failed, but version 1.7.0,1.7.2 is OK.

root@ide-staging-01:~# pip freeze | grep docker-py && python --version && docker version
docker-py==1.8.1
Python 2.7.6
Client:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:30:23 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:30:23 2016
 OS/Arch:      linux/amd64
root@ide-staging-01:~# uname -a
Linux ide-staging-01 3.19.0-23-generic #24~14.04.1-Ubuntu SMP Wed Jul 8 11:15:13 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@ide-staging-01:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty
root@ide-staging-01:~# python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from docker import Client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/docker/__init__.py", line 20, in <module>
    from .client import Client, AutoVersionClient, from_env # flake8: noqa
  File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 25, in <module>
    from . import api
  File "/usr/local/lib/python2.7/dist-packages/docker/api/__init__.py", line 2, 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 1, in <module>
    from .utils import (
  File "/usr/local/lib/python2.7/dist-packages/docker/utils/utils.py", line 33, in <module>
    from .. import tls
  File "/usr/local/lib/python2.7/dist-packages/docker/tls.py", line 5, in <module>
    from .ssladapter import ssladapter
  File "/usr/local/lib/python2.7/dist-packages/docker/ssladapter/__init__.py", line 1, in <module>
    from .ssladapter import SSLAdapter # flake8: noqa
  File "/usr/local/lib/python2.7/dist-packages/docker/ssladapter/ssladapter.py", line 22, in <module>
    urllib3.connection.match_hostname = match_hostname
AttributeError: 'module' object has no attribute 'connection'
>>>

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:4
  • Comments:29 (1 by maintainers)

github_iconTop GitHub Comments

26reactions
c-nicholscommented, Feb 9, 2017

I solved this issue with the following: sudo pip install --upgrade pip Ubuntu/Debian’s default version of pip will alter sys.path and thus force requests and urllib3 down to older versions. Docker compose uses pip on startup to detect if old versions are installed.

This was actually on Bash on Ubuntu for Windows.

20reactions
aschemancommented, Sep 14, 2016

Had the same problem with

  • ubuntu 14.04
  • docker 1.12.1
  • docker-py==1.8.1
  • urllib3==1.7.1

Solved it by

pip install urllib3==1.14

and

export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python AttributeError: 'module' object has no attribute 'connect'
The line 'AttributeError: 'module' object has no attribute 'connect' tells you that when you run your script it reads itself assuming it is ......
Read more >
AttributeError: 'module' object has no attribute 'Connection' #13
I have run python setup.py install without errors, and then python server.py got me this: $ python server.py Traceback (most recent call last):...
Read more >
AttributeError: 'module' object has no attribute 'Connection'
I'm starting a new project with pyramid and mongodb. When I run the command: development.ini pserve shows the following error:.
Read more >
[Solved] AttributeError: 'module' object has no attribute
Click here to subscribe - https://www.youtube.com/channel/UCeVMnSShP_Iviwkknt83cww▻Instagram ...
Read more >
Python – AttributeError: 'module' object has no attribute 'connect'
I'm trying to connect to locally installed sql server 2014, using pymssql-2.1.1-cp27-none-win_amd64. I tried even import pymssql , nothing changed. According to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found