Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requests 2.18.0 breaks docker-py #4160

Closed
chenww opened this issue Jun 14, 2017 · 12 comments
Closed

requests 2.18.0 breaks docker-py #4160

chenww opened this issue Jun 14, 2017 · 12 comments

Comments

@chenww
Copy link

chenww commented Jun 14, 2017

Summary.
Got bitten right after this new requests version released. When I run with docker-py, it is fine before. now it is complaining :
Error while fetching server API version: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int, float or None.

Expected Result

backward compatibility should be maintained from requests module

What you expected.

Actual Result

python

Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import docker
c = docker.Client(base_url='unix://var/run/docker.sock', version='1.15', timeout=2.0)
l = c.containers(all=True)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/docker/api/container.py", line 85, in containers
res = self._result(self._get(u, params=params), True)
File "/usr/lib/python2.7/site-packages/docker/utils/decorators.py", line 47, in inner
return f(self, *args, **kwargs)
File "/usr/lib/python2.7/site-packages/docker/client.py", line 139, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 515, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 587, in urlopen
timeout_obj = self._get_timeout(timeout)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 302, in _get_timeout
return Timeout.from_float(timeout)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 154, in from_float
return Timeout(read=timeout, connect=timeout)
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 94, in init
self._connect = self._validate_timeout(connect, 'connect')
File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.py", line 127, in _validate_timeout
"int, float or None." % (name, value))
ValueError: Timeout value connect was Timeout(connect=2.0, read=2.0, total=None), but it must be an int, float or None.

Reproduction Steps

pip install requests==2.17.3

Collecting requests==2.17.3
Using cached requests-2.17.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests==2.17.3)
Requirement already satisfied (use --upgrade to upgrade): certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests==2.17.3)
Requirement already satisfied (use --upgrade to upgrade): idna<2.6,>=2.5 in /usr/lib/python2.7/site-packages (from requests==2.17.3)
Requirement already satisfied (use --upgrade to upgrade): urllib3<1.22,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests==2.17.3)
Installing collected packages: requests
Found existing installation: requests 2.18.0
Uninstalling requests-2.18.0:
Successfully uninstalled requests-2.18.0
Successfully installed requests-2.17.3
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@bootserver-do-not-delete ~]# python
Python 2.7.5 (default, Nov 6 2016, 00:28:07)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import docker
c = docker.Client(base_url='unix://var/run/docker.sock', version='1.15', timeout=2.0)
l = c.containers(all=True)

this works

System Information

$ python -m requests.help

$ python -m requests.help
{
"chardet": {
"version": "3.0.4"
},
"cryptography": {
"version": ""
},
"implementation": {
"name": "CPython",
"version": "2.7.5"
},
"platform": {
"release": "3.10.0-514.21.1.el7.x86_64",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "",
"version": null
},
"requests": {
"version": "2.18.0"
},
"system_ssl": {
"version": "1000105f"
},
"urllib3": {
"version": "1.21.1"
},
"using_pyopenssl": false
}

<paste here>
@Lukasa
Copy link
Member

Lukasa commented Jun 14, 2017

Well this is extremely perplexing. It seems like the fix that landed in 2.17.3 to resolve the packages problem is not present in 2.18. I have no idea what has happened here, because none of the diff between the 2.17.3 tag and the 2.18 tag contains anything that looks like it'd affect this.

@Lukasa
Copy link
Member

Lukasa commented Jun 14, 2017

Ok, got it. This is a problem with having old data left behind in my copy of the repo, which means when I did the release we broke the wheel. I'm sorry about that, I'll push out a v2.18.1 shortly.

@Lukasa
Copy link
Member

Lukasa commented Jun 14, 2017

2.18.1 has been released that should fix this problem. There's no need for code changes: this was purely an issue with my on-disk copy of the code. Sorry about that!

@chenww
Copy link
Author

chenww commented Jun 15, 2017

that fixes the issue. thanks for quick turnaround

@Toonix
Copy link

Toonix commented Sep 22, 2017

I still have this problem....

my versions are:

rancher@RancherOS1_SRV:~$ pip freeze
backports.ssl-match-hostname==3.5.0.1
certifi==2017.7.27.1
chardet==3.0.4
cryptography==1.7.1
docker-py==1.10.6
docker-pycreds==0.2.1
enum34==1.1.6
idna==2.6
ipaddress==1.0.18
keyring==10.1
keyrings.alt==1.3
pyasn1==0.1.9
pycrypto==2.6.1
pygobject==3.22.0
python-apt==1.4.0b3
pyxdg==0.25
requests==2.18.4
SecretStorage==2.3.1
six==1.11.0
urllib3==1.22
websocket-client==0.44.0

@titilambert
Copy link

Same here with requests 2.18.4, fixed with 2.18.1

@oussemos
Copy link

Same ! got this problem with 2.18.4 and fixed with 2.18.1 !

@nateprewitt
Copy link
Member

@oussemos @titilambert, could you please confirm that 2.18.1 is the latest version that works for you? (i.e. 2.18.2 and 2.18.3 don't work either?)

@zikphil
Copy link

zikphil commented Nov 10, 2017

Same issue with 2.18.4

@butla
Copy link

butla commented Nov 15, 2017

With Docker Compose 1.17.1 the latest requests that work for me is 2.15.1...

@dragomirr
Copy link

dragomirr commented Nov 29, 2017

@butla same here. 2.15.1 is only version that works with docker compose 1.17.1

@pnkumar9
Copy link

Updated pip and saw this error Error connecting: Error while fetching server API version: Timeout value connect was Timeout(connect=60, read=60, total=None), but it must be an int or float.
pip freeze
Cheetah==2.4.4
Landscape-Client==14.12
PAM==0.4.2
PyYAML==3.10
Twisted-Core==13.2.0
Twisted-Names==13.2.0
Twisted-Web==13.2.0
apt-xapian-index==0.45
argparse==1.2.1
backports.ssl-match-hostname==3.5.0.1
certifi==2018.4.16
chardet==3.0.4
cloud-init==0.7.5
colorama==0.2.5
configobj==4.7.2
docker-py==1.8.1
html5lib==0.999
idna==2.7
jsonpatch==1.3
jsonpointer==1.0
oauth==1.0.1
prettytable==0.7.2
psycopg2==2.4.5
pyOpenSSL==0.13
pycrypto==2.6.1
pycurl==7.19.3
pyserial==2.6
python-apt===0.9.3.5ubuntu2
python-debian===0.1.21-nmu2ubuntu2
requests==2.19.1
six==1.9.0
ssh-import-id==3.21
urllib3==1.23
websocket-client==0.35.0
wheel==0.24.0
wsgiref==0.1.2
zope.interface==4.0.5

@psf psf locked as resolved and limited conversation to collaborators Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants