kubernetes-client / python

Official Python client library for kubernetes
http://kubernetes.io/
Apache License 2.0
6.83k stars 3.28k forks source link

SSL error when connecting to cluster #155

Closed cristifalcas closed 7 years ago

cristifalcas commented 7 years ago

I'm trying to use the default example, but it fails with an ssl error.

Code:

    from kubernetes import client, config
    config.load_incluster_config()

    v1=client.CoreV1Api()
    print("Listing pods with their IPs:")
    ret = v1.list_pod_for_all_namespaces(watch=False)
    for i in ret.items:
        print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))

This is the exception:

    Listing pods with their IPs:
    2017-03-09 17:04:23,114 ERROR Certificate did not match expected hostname: 10.255.1.1. Certificate: {'subjectAltName': (('DNS', 'machine-kb-01.company.net'), ('DNS', 'kubernetes'), ('DNS', 'kubernetes.default'), ('DNS', 'kubernetes.default.svc'), ('DNS', 'kubernetes.default.svc.optykube'), ('IP Address', '10.255.1.1'), ('IP Address', '10.100.4.134')), 'notBefore': u'Feb  2 15:48:30 2017 GMT', 'serialNumber': u'9ECB58DC6E074A51', 'notAfter': 'Jan 31 15:48:30 2027 GMT', 'version': 3L, 'subject': ((('commonName', u'machine-kb-01.company.net'),),), 'issuer': ((('commonName', u'Puppet CA: puppet.company.net'),),)}
    Traceback (most recent call last):
    File "/q.py", line 14, in <module>
        ret = v1.list_pod_for_all_namespaces(watch=False)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13586, in list_pod_for_all_namespaces
        (data) = self.list_pod_for_all_namespaces_with_http_info(**kwargs)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/apis/core_v1_api.py", line 13679, in list_pod_for_all_namespaces_with_http_info
        collection_formats=collection_formats)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 329, in call_api
        _return_http_data_only, collection_formats, _preload_content, _request_timeout)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 153, in __call_api
        _request_timeout=_request_timeout)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/api_client.py", line 361, in request
        headers=headers)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/rest.py", line 240, in GET
        query_params=query_params)
    File "/usr/lib/python2.7/site-packages/kubernetes/client/rest.py", line 217, in request
        raise ApiException(status=0, reason=msg)
    kubernetes.client.rest.ApiException: (0)
    Reason: SSLError
    hostname '10.255.1.1' doesn't match either of 'machine-kb-01.company.net', 'kubernetes', 'kubernetes.default', 'kubernetes.default.svc', 'kubernetes.default.svc.optykube'

The error is clear: it doesn't check the 'IP Address', only 'DNS'.

I'm on el7. Those are the python packages installed:

    # rpm -qa | grep python | sort
    dbus-python-1.1.1-9.el7.x86_64
    libselinux-python-2.5-6.el7.x86_64
    python-2.7.5-48.0.1.el7.x86_64
    python-certifi-2017.01.23-1.el7.noarch
    python-configobj-4.7.2-7.el7.noarch
    python-dateutil-2.6.0-3.el7.noarch
    python-decorator-3.4.0-3.el7.noarch
    python-firewall-0.4.3.2-8.1.el7_3.noarch
    python-httplib2-0.7.7-3.el7.noarch
    python-iniparse-0.4-9.el7.noarch
    python-ipaddress-1.0.16-2.el7.noarch
    python-kubernetes-1.0.0-2.el7.noarch
    python-libs-2.7.5-48.0.1.el7.x86_64
    python-oauth2client-4.0.0-2.el7.noarch
    python-perf-3.10.0-514.6.1.el7.x86_64
    python-pycurl-7.19.0-19.el7.x86_64
    python-pyudev-0.15-7.el7_2.1.noarch
    python-setuptools-27.3.0-1.noarch
    python-six-1.9.0-2.el7.noarch
    python-slip-0.4.0-2.el7.noarch
    python-slip-dbus-0.4.0-2.el7.noarch
    python-urlgrabber-3.10-8.el7.noarch
    python-urllib3-1.17-1.noarch
    python-websocket-client-0.32.0-116.el7.noarch
    python2-pip-8.1.2-5.el7.noarch
    python2-pyasn1-0.1.9-7.el7.noarch
    python2-rsa-3.4.1-1.el7.noarch
    rpm-python-4.11.3-21.el7.x86_64

If you need other packages versions, let me know for which of them.

Thank you, Cristian

sebgoa commented 7 years ago

Are you running this python example in a Pod that is running within the cluster ?

That's what the load_incluster_config( ) function does. It loads the service account credentials to talk to the API server from within the cluster.

sebgoa commented 7 years ago

if you are accessing the API from your local machine, you need to use config.load_kube_config() this will load the current context from your kubeconfig file.

mbohlool commented 7 years ago

this should be related to "ipaddress" package. I see the requirement for this package's version is not met (the requirements file listed 1.0.17 minimum version for that package). Also can you list your packages using pip tool and also provide information about your python version, kubernetes version and how you installed it.

cristifalcas commented 7 years ago

@sebgoa Yes, I',m inside a pod.

@mbohlool I will update the ipaddress package and update you. I listed all python packages versions we used in the original post. We don't install anything with pip, we rely on os packages and build our own rpms for missing ones.

cristifalcas commented 7 years ago

I got the same error with latest ipaddress:

# python -c "import ipaddress; print ipaddress.__version__"
1.0.18

Installed python versions:

    # rpm -qa | grep python | sort
    dbus-python-1.1.1-9.el7.x86_64
    libselinux-python-2.5-6.el7.x86_64
    python-2.7.5-48.0.1.el7.x86_64
    python-certifi-2017.01.23-1.el7.noarch
    python-configobj-4.7.2-7.el7.noarch
    python-dateutil-2.6.0-3.el7.noarch
    python-decorator-3.4.0-3.el7.noarch
    python-firewall-0.4.3.2-8.1.el7_3.2.noarch
    python-httplib2-0.7.7-3.el7.noarch
    python-iniparse-0.4-9.el7.noarch
    python-ipaddress-1.0.18-1.el7.noarch
    python-kubernetes-1.0.0-3.el7.noarch
    python-libs-2.7.5-48.0.1.el7.x86_64
    python-oauth2client-4.0.0-3.el7.noarch
    python-perf-3.10.0-514.10.2.el7.x86_64
    python-pycurl-7.19.0-19.el7.x86_64
    python-pyudev-0.15-7.el7_2.1.noarch
    python-setuptools-27.3.0-1.noarch
    python-six-1.9.0-2.el7.noarch
    python-slip-0.4.0-2.el7.noarch
    python-slip-dbus-0.4.0-2.el7.noarch
    python-urlgrabber-3.10-8.el7.noarch
    python-urllib3-1.17-1.noarch
    python-websocket-client-0.32.0-116.el7.noarch
    python2-pip-8.1.2-5.el7.noarch
    python2-pyasn1-0.1.9-7.el7.noarch
    python2-rsa-3.4.1-1.el7.noarch
    rpm-python-4.11.3-21.el7.x86_64
cristifalcas commented 7 years ago

Ok, it worked after I did

pip install --upgrade kubernetes

I need to see which package nedded to be upgraded

mbohlool commented 7 years ago

I am interested to see how this works out. Till now I only used pip to install kubernetes client and all dependencies. Let me know if you succeeded in making your own RPM with all dependencies.

cristifalcas commented 7 years ago

We had to upgrade some packages and also to create new ones. Here is a list with the versions:

python-kubernetes                                           1.0.0-5.el7 (new)
python-backports-ssl_match_hostname                         3.5.0.1-1.el7 (needed update from 3.4.0)
python-certifi                                              2017.01.23-1.el7 (new)
python-ipaddress                                            1.0.18-1.el7 (updated per your recommandation)
python-oauth2client                                         4.0.0-4.el7 (new)
python-urllib3                                              1.20-2.el7 (updated package, not sure it was needed )
python-websocket-client                                     0.40.0-1.el7 (updated package, not sure it was needed )

Most of them where build from fedora spec files.

Some of them maybe don't need the latest version.

mbohlool commented 7 years ago

My money's on python-backports-ssl_match_hostname and python-ipaddress.

dohnto commented 7 years ago

I can see this still failing on debian. Any tips what to upgrade?

# cat Dockerfile
FROM debian:jessie

RUN apt-get update \ 
    && apt-get install -y \
        python3 \
        python3-pip

RUN pip3 install kubernetes
# pip3 freeze
PyYAML==3.12
certifi==2017.1.23
chardet==2.3.0
colorama==0.3.2
html5lib==0.999
httplib2==0.10.3
ipaddress==1.0.18
kubernetes==1.0.0
oauth2client==4.0.0
pyasn1==0.2.3
pyasn1-modules==0.0.8
python-dateutil==2.6.0
requests==2.4.3
rsa==3.4.2
six==1.8.0
urllib3==1.9.1
websocket-client==0.40.0
wheel==0.24.0
# dpkg -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                          Version                     Architecture                Description
+++-=============================================-===========================-===========================-================================================================================================
ii  acl                                           2.2.52-2                    amd64                       Access control list utilities
ii  adduser                                       3.113+nmu3                  all                         add and remove users and groups
ii  apt                                           1.0.9.8.4                   amd64                       commandline package manager
ii  base-files                                    8+deb8u7                    amd64                       Debian base system miscellaneous files
ii  base-passwd                                   3.5.37                      amd64                       Debian base system master password and group files
ii  bash                                          4.3-11+deb8u1               amd64                       GNU Bourne Again SHell
ii  binutils                                      2.25-5                      amd64                       GNU assembler, linker and binary utilities
ii  bsdutils                                      1:2.25.2-6                  amd64                       basic utilities from 4.4BSD-Lite
ii  build-essential                               11.7                        amd64                       Informational list of build-essential packages
ii  bzip2                                         1.0.6-7+b3                  amd64                       high-quality block-sorting file compressor - utilities
ii  ca-certificates                               20141019+deb8u2             all                         Common CA certificates
ii  coreutils                                     8.23-4                      amd64                       GNU core utilities
ii  cpp                                           4:4.9.2-2                   amd64                       GNU C preprocessor (cpp)
ii  cpp-4.9                                       4.9.2-10                    amd64                       GNU C preprocessor
ii  dash                                          0.5.7-4+b1                  amd64                       POSIX-compliant shell
ii  debconf                                       1.5.56                      all                         Debian configuration management system
ii  debconf-i18n                                  1.5.56                      all                         full internationalization support for debconf
ii  debian-archive-keyring                        2014.3                      all                         GnuPG archive keys of the Debian archive
ii  debianutils                                   4.4+b1                      amd64                       Miscellaneous utilities specific to Debian
ii  dh-python                                     1.20141111-2                all                         Debian helper tools for packaging Python libraries and applications
ii  diffutils                                     1:3.3-1+b1                  amd64                       File comparison utilities
ii  dmsetup                                       2:1.02.90-2.2+deb8u1        amd64                       Linux Kernel Device Mapper userspace library
ii  dpkg                                          1.17.27                     amd64                       Debian package management system
ii  dpkg-dev                                      1.17.27                     all                         Debian package development tools
ii  e2fslibs:amd64                                1.42.12-2+b1                amd64                       ext2/ext3/ext4 file system libraries
ii  e2fsprogs                                     1.42.12-2+b1                amd64                       ext2/ext3/ext4 file system utilities
ii  fakeroot                                      1.20.2-1                    amd64                       tool for simulating superuser privileges
ii  file                                          1:5.22+15-2+deb8u3          amd64                       Determines file type using "magic" numbers
ii  findutils                                     4.4.2-9+b1                  amd64                       utilities for finding files--find, xargs
ii  g++                                           4:4.9.2-2                   amd64                       GNU C++ compiler
ii  g++-4.9                                       4.9.2-10                    amd64                       GNU C++ compiler
ii  gcc                                           4:4.9.2-2                   amd64                       GNU C compiler
ii  gcc-4.8-base:amd64                            4.8.4-1                     amd64                       GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9                                       4.9.2-10                    amd64                       GNU C compiler
ii  gcc-4.9-base:amd64                            4.9.2-10                    amd64                       GCC, the GNU Compiler Collection (base package)
ii  gnupg                                         1.4.18-7+deb8u3             amd64                       GNU privacy guard - a free PGP replacement
ii  gpgv                                          1.4.18-7+deb8u3             amd64                       GNU privacy guard - signature verification tool
ii  grep                                          2.20-4.1                    amd64                       GNU grep, egrep and fgrep
ii  gzip                                          1.6-4                       amd64                       GNU compression utilities
ii  hostname                                      3.15                        amd64                       utility to set/show the host name or domain name
ii  ifupdown                                      0.7.53.1                    amd64                       high level tools to configure network interfaces
ii  init                                          1.22                        amd64                       System-V-like init utilities - metapackage
ii  initscripts                                   2.88dsf-59                  amd64                       scripts for initializing and shutting down the system
ii  insserv                                       1.14.0-5                    amd64                       boot sequence organizer using LSB init.d script dependency information
ii  iproute2                                      3.16.0-2                    amd64                       networking and traffic control tools
ii  isc-dhcp-client                               4.3.1-6+deb8u2              amd64                       DHCP client for automatically obtaining an IP address
ii  isc-dhcp-common                               4.3.1-6+deb8u2              amd64                       common files used by all of the isc-dhcp packages
ii  libacl1:amd64                                 2.2.52-2                    amd64                       Access control list shared library
ii  libalgorithm-c3-perl                          0.09-1                      all                         Perl module for merging hierarchies using the C3 algorithm
ii  libalgorithm-diff-perl                        1.19.02-3                   all                         module to find differences between files
ii  libalgorithm-diff-xs-perl                     0.04-3+b1                   amd64                       module to find differences between files (XS accelerated)
ii  libalgorithm-merge-perl                       0.08-2                      all                         Perl module for three-way merge of textual data
ii  libapt-pkg4.12:amd64                          1.0.9.8.4                   amd64                       package management runtime library
ii  libarchive-extract-perl                       0.72-1                      all                         generic archive extracting module
ii  libasan1:amd64                                4.9.2-10                    amd64                       AddressSanitizer -- a fast memory error detector
ii  libatm1:amd64                                 1:2.5.1-1.5                 amd64                       shared library for ATM (Asynchronous Transfer Mode)
ii  libatomic1:amd64                              4.9.2-10                    amd64                       support library providing __atomic built-in functions
ii  libattr1:amd64                                1:2.4.47-2                  amd64                       Extended attribute shared library
ii  libaudit-common                               1:2.4-1                     all                         Dynamic library for security auditing - common files
ii  libaudit1:amd64                               1:2.4-1+b1                  amd64                       Dynamic library for security auditing
ii  libblkid1:amd64                               2.25.2-6                    amd64                       block device id library
ii  libbz2-1.0:amd64                              1.0.6-7+b3                  amd64                       high-quality block-sorting file compressor library - runtime
ii  libc-bin                                      2.19-18+deb8u7              amd64                       GNU C Library: Binaries
ii  libc-dev-bin                                  2.19-18+deb8u7              amd64                       GNU C Library: Development binaries
ii  libc6:amd64                                   2.19-18+deb8u7              amd64                       GNU C Library: Shared libraries
ii  libc6-dev:amd64                               2.19-18+deb8u7              amd64                       GNU C Library: Development Libraries and Header Files
ii  libcap2:amd64                                 1:2.24-8                    amd64                       POSIX 1003.1e capabilities (library)
ii  libcap2-bin                                   1:2.24-8                    amd64                       POSIX 1003.1e capabilities (utilities)
ii  libcgi-fast-perl                              1:2.04-1                    all                         CGI subclass for work with FCGI
ii  libcgi-pm-perl                                4.09-1                      all                         module for Common Gateway Interface applications
ii  libcilkrts5:amd64                             4.9.2-10                    amd64                       Intel Cilk Plus language extensions (runtime)
ii  libclass-c3-perl                              0.26-1                      all                         pragma for using the C3 method resolution order
ii  libclass-c3-xs-perl                           0.13-2+b1                   amd64                       Perl module to accelerate Class::C3
ii  libcloog-isl4:amd64                           0.18.2-1+b2                 amd64                       Chunky Loop Generator (runtime library)
ii  libcomerr2:amd64                              1.42.12-2+b1                amd64                       common error description library
ii  libcpan-meta-perl                             2.142690-1                  all                         Perl module to access CPAN distributions metadata
ii  libcryptsetup4:amd64                          2:1.6.6-5                   amd64                       disk encryption support - shared library
ii  libdata-optlist-perl                          0.109-1                     all                         module to parse and validate simple name/value option pairs
ii  libdata-section-perl                          0.200006-1                  all                         module to read chunks of data from a module's DATA section
ii  libdb5.3:amd64                                5.3.28-9                    amd64                       Berkeley v5.3 Database Libraries [runtime]
ii  libdebconfclient0:amd64                       0.192                       amd64                       Debian Configuration Management System (C-implementation library)
ii  libdevmapper1.02.1:amd64                      2:1.02.90-2.2+deb8u1        amd64                       Linux Kernel Device Mapper userspace library
ii  libdns-export100                              1:9.9.5.dfsg-9+deb8u10      amd64                       Exported DNS Shared Library
ii  libdpkg-perl                                  1.17.27                     all                         Dpkg perl modules
ii  libexpat1:amd64                               2.1.0-6+deb8u3              amd64                       XML parsing C library - runtime library
ii  libexpat1-dev:amd64                           2.1.0-6+deb8u3              amd64                       XML parsing C library - development kit
ii  libfakeroot:amd64                             1.20.2-1                    amd64                       tool for simulating superuser privileges - shared libraries
ii  libfcgi-perl                                  0.77-1+deb8u1               amd64                       helper module for FastCGI
ii  libffi6:amd64                                 3.1-2+b2                    amd64                       Foreign Function Interface library runtime
ii  libfile-fcntllock-perl                        0.22-1+b1                   amd64                       Perl module for file locking with fcntl(2)
ii  libgcc-4.9-dev:amd64                          4.9.2-10                    amd64                       GCC support library (development files)
ii  libgcc1:amd64                                 1:4.9.2-10                  amd64                       GCC support library
ii  libgcrypt20:amd64                             1.6.3-2+deb8u2              amd64                       LGPL Crypto library - runtime library
ii  libgdbm3:amd64                                1.8.3-13.1                  amd64                       GNU dbm database routines (runtime version)
ii  libgmp10:amd64                                2:6.0.0+dfsg-6              amd64                       Multiprecision arithmetic library
ii  libgomp1:amd64                                4.9.2-10                    amd64                       GCC OpenMP (GOMP) support library
ii  libgpg-error0:amd64                           1.17-3                      amd64                       library for common error values and messages in GnuPG components
ii  libirs-export91                               1:9.9.5.dfsg-9+deb8u10      amd64                       Exported IRS Shared Library
ii  libisc-export95                               1:9.9.5.dfsg-9+deb8u10      amd64                       Exported ISC Shared Library
ii  libisccfg-export90                            1:9.9.5.dfsg-9+deb8u10      amd64                       Exported ISC CFG Shared Library
ii  libisl10:amd64                                0.12.2-2                    amd64                       manipulating sets and relations of integer points bounded by linear constraints
ii  libitm1:amd64                                 4.9.2-10                    amd64                       GNU Transactional Memory Library
ii  libkmod2:amd64                                18-3                        amd64                       libkmod shared library
ii  liblocale-gettext-perl                        1.05-8+b1                   amd64                       module using libc functions for internationalization in Perl
ii  liblog-message-perl                           0.8-1                       all                         powerful and flexible message logging mechanism
ii  liblog-message-simple-perl                    0.10-2                      all                         simplified interface to Log::Message
ii  liblsan0:amd64                                4.9.2-10                    amd64                       LeakSanitizer -- a memory leak detector (runtime)
ii  liblzma5:amd64                                5.1.1alpha+20120614-2+b3    amd64                       XZ-format compression library
ii  libmagic1:amd64                               1:5.22+15-2+deb8u3          amd64                       File type determination library using "magic" numbers
ii  libmodule-build-perl                          0.421000-2+deb8u1           all                         framework for building and installing Perl modules
ii  libmodule-pluggable-perl                      5.1-1                       all                         module for giving  modules the ability to have plugins
ii  libmodule-signature-perl                      0.73-1+deb8u2               all                         module to manipulate CPAN SIGNATURE files
ii  libmount1:amd64                               2.25.2-6                    amd64                       device mounting library
ii  libmpc3:amd64                                 1.0.2-1                     amd64                       multiple precision complex floating-point library
ii  libmpdec2:amd64                               2.4.1-1                     amd64                       library for decimal floating point arithmetic (runtime library)
ii  libmpfr4:amd64                                3.1.2-2                     amd64                       multiple precision floating-point computation
ii  libmro-compat-perl                            0.12-1                      all                         mro::* interface compatibility for Perls < 5.9.5
ii  libncurses5:amd64                             5.9+20140913-1+b1           amd64                       shared libraries for terminal handling
ii  libncursesw5:amd64                            5.9+20140913-1+b1           amd64                       shared libraries for terminal handling (wide character support)
ii  libpackage-constants-perl                     0.04-1                      all                         List constants defined in a package
ii  libpam-modules:amd64                          1.1.8-3.1+deb8u2            amd64                       Pluggable Authentication Modules for PAM
ii  libpam-modules-bin                            1.1.8-3.1+deb8u2            amd64                       Pluggable Authentication Modules for PAM - helper binaries
ii  libpam-runtime                                1.1.8-3.1+deb8u2            all                         Runtime support for the PAM library
ii  libpam0g:amd64                                1.1.8-3.1+deb8u2            amd64                       Pluggable Authentication Modules library
ii  libparams-util-perl                           1.07-2+b1                   amd64                       Perl extension for simple stand-alone param checking functions
ii  libpcre3:amd64                                2:8.35-3.3+deb8u4           amd64                       Perl 5 Compatible Regular Expression Library - runtime files
ii  libpod-latex-perl                             0.61-1                      all                         module to convert Pod data to formatted LaTeX
ii  libpod-readme-perl                            0.11-1                      all                         Perl module to convert POD to README file
ii  libprocps3:amd64                              2:3.3.9-9                   amd64                       library for accessing process information from /proc
ii  libpython3-dev:amd64                          3.4.2-2                     amd64                       header files and a static library for Python (default)
ii  libpython3-stdlib:amd64                       3.4.2-2                     amd64                       interactive high-level object-oriented language (default python3 version)
ii  libpython3.4:amd64                            3.4.2-1                     amd64                       Shared Python runtime library (version 3.4)
ii  libpython3.4-dev:amd64                        3.4.2-1                     amd64                       Header files and a static library for Python (v3.4)
ii  libpython3.4-minimal:amd64                    3.4.2-1                     amd64                       Minimal subset of the Python language (version 3.4)
ii  libpython3.4-stdlib:amd64                     3.4.2-1                     amd64                       Interactive high-level object-oriented language (standard library, version 3.4)
ii  libquadmath0:amd64                            4.9.2-10                    amd64                       GCC Quad-Precision Math Library
ii  libreadline6:amd64                            6.3-8+b3                    amd64                       GNU readline and history libraries, run-time libraries
ii  libregexp-common-perl                         2013031301-1                all                         module with common regular expressions
ii  libselinux1:amd64                             2.3-2                       amd64                       SELinux runtime shared libraries
ii  libsemanage-common                            2.3-1                       all                         Common files for SELinux policy management libraries
ii  libsemanage1:amd64                            2.3-1+b1                    amd64                       SELinux policy management library
ii  libsepol1:amd64                               2.3-2                       amd64                       SELinux library for manipulating binary security policies
ii  libslang2:amd64                               2.3.0-2                     amd64                       S-Lang programming library - runtime version
ii  libsmartcols1:amd64                           2.25.2-6                    amd64                       smart column output alignment library
ii  libsoftware-license-perl                      0.103010-3                  all                         module providing templated software licenses
ii  libsqlite3-0:amd64                            3.8.7.1-1+deb8u2            amd64                       SQLite 3 shared library
ii  libss2:amd64                                  1.42.12-2+b1                amd64                       command-line interface parsing library
ii  libssl1.0.0:amd64                             1.0.1t-1+deb8u6             amd64                       Secure Sockets Layer toolkit - shared libraries
ii  libstdc++-4.9-dev:amd64                       4.9.2-10                    amd64                       GNU Standard C++ Library v3 (development files)
ii  libstdc++6:amd64                              4.9.2-10                    amd64                       GNU Standard C++ Library v3
ii  libsub-exporter-perl                          0.986-1                     all                         sophisticated exporter for custom-built routines
ii  libsub-install-perl                           0.928-1                     all                         module for installing subroutines into packages easily
ii  libsystemd0:amd64                             215-17+deb8u6               amd64                       systemd utility library
ii  libterm-ui-perl                               0.42-1                      all                         Term::ReadLine UI made easy
ii  libtext-charwidth-perl                        0.04-7+b3                   amd64                       get display widths of characters on the terminal
ii  libtext-iconv-perl                            1.7-5+b2                    amd64                       converts between character sets in Perl
ii  libtext-soundex-perl                          3.4-1+b2                    amd64                       implementation of the soundex algorithm
ii  libtext-template-perl                         1.46-1                      all                         perl module to process text templates
ii  libtext-wrapi18n-perl                         0.06-7                      all                         internationalized substitute of Text::Wrap
ii  libtimedate-perl                              2.3000-2                    all                         collection of modules to manipulate date/time information
ii  libtinfo5:amd64                               5.9+20140913-1+b1           amd64                       shared low-level terminfo library for terminal handling
ii  libtsan0:amd64                                4.9.2-10                    amd64                       ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii  libubsan0:amd64                               4.9.2-10                    amd64                       UBSan -- undefined behaviour sanitizer (runtime)
ii  libudev1:amd64                                215-17+deb8u6               amd64                       libudev shared library
ii  libusb-0.1-4:amd64                            2:0.1.12-25                 amd64                       userspace USB programming library
ii  libustr-1.0-1:amd64                           1.0.4-3+b2                  amd64                       Micro string library: shared library
ii  libuuid1:amd64                                2.25.2-6                    amd64                       Universally Unique ID library
ii  libxtables10                                  1.4.21-2+b1                 amd64                       netfilter xtables library
ii  linux-libc-dev:amd64                          3.16.39-1+deb8u2            amd64                       Linux support headers for userspace development
ii  locales                                       2.19-18+deb8u7              all                         GNU C Library: National Language (locale) data [support]
ii  login                                         1:4.2-3+deb8u3              amd64                       system login tools
ii  lsb-base                                      4.1+Debian13+nmu1           all                         Linux Standard Base 4.1 init script functionality
ii  make                                          4.0-8.1                     amd64                       utility for directing compilation
ii  manpages                                      3.74-1                      all                         Manual pages about using a GNU/Linux system
ii  manpages-dev                                  3.74-1                      all                         Manual pages about using GNU/Linux for development
ii  mawk                                          1.3.3-17                    amd64                       a pattern scanning and text processing language
ii  mime-support                                  3.58                        all                         MIME files 'mime.types' & 'mailcap', and support programs
ii  mount                                         2.25.2-6                    amd64                       Tools for mounting and manipulating filesystems
ii  multiarch-support                             2.19-18+deb8u7              amd64                       Transitional package to ensure multiarch compatibility
ii  ncurses-base                                  5.9+20140913-1              all                         basic terminal type definitions
ii  ncurses-bin                                   5.9+20140913-1+b1           amd64                       terminal-related programs and man pages
ii  netbase                                       5.3                         all                         Basic TCP/IP networking system
ii  openssl                                       1.0.1t-1+deb8u6             amd64                       Secure Sockets Layer toolkit - cryptographic utility
ii  passwd                                        1:4.2-3+deb8u3              amd64                       change and administer password and group data
ii  patch                                         2.7.5-1                     amd64                       Apply a diff file to an original
ii  perl                                          5.20.2-3+deb8u6             amd64                       Larry Wall's Practical Extraction and Report Language
ii  perl-base                                     5.20.2-3+deb8u6             amd64                       minimal Perl system
ii  perl-modules                                  5.20.2-3+deb8u6             all                         Core Perl modules
ii  procps                                        2:3.3.9-9                   amd64                       /proc file system utilities
ii  python3                                       3.4.2-2                     amd64                       interactive high-level object-oriented language (default python3 version)
ii  python3-chardet                               2.3.0-1                     all                         universal character encoding detector for Python3
ii  python3-colorama                              0.3.2-1                     all                         Cross-platform colored terminal text in Python - Python 3.x
ii  python3-dev                                   3.4.2-2                     amd64                       header files and a static library for Python (default)
ii  python3-distlib                               0.1.9-1                     all                         low-level components of python distutils2/packaging
ii  python3-html5lib                              0.999-3                     all                         HTML parser/tokenizer based on the WHATWG HTML5 specification (Python 3)
ii  python3-minimal                               3.4.2-2                     amd64                       minimal subset of the Python language (default python3 version)
ii  python3-pip                                   1.5.6-5                     all                         alternative Python package installer - Python 3 version of the package
ii  python3-pkg-resources                         5.5.1-1                     all                         Package Discovery and Resource Access using pkg_resources
ii  python3-requests                              2.4.3-6                     all                         elegant and simple HTTP library for Python3, built for human beings
ii  python3-setuptools                            5.5.1-1                     all                         Python3 Distutils Enhancements
ii  python3-six                                   1.8.0-1                     all                         Python 2 and 3 compatibility library (Python 3 interface)
ii  python3-urllib3                               1.9.1-3                     all                         HTTP library with thread-safe connection pooling for Python3
ii  python3-wheel                                 0.24.0-1                    all                         built-package format for Python
ii  python3.4                                     3.4.2-1                     amd64                       Interactive high-level object-oriented language (version 3.4)
ii  python3.4-dev                                 3.4.2-1                     amd64                       Header files and a static library for Python (v3.4)
ii  python3.4-minimal                             3.4.2-1                     amd64                       Minimal subset of the Python language (version 3.4)
ii  readline-common                               6.3-8                       all                         GNU readline and history libraries, common files
ii  rename                                        0.20-3                      all                         Perl extension for renaming multiple files
ii  sed                                           4.2.2-4+deb8u1              amd64                       The GNU sed stream editor
ii  sensible-utils                                0.0.9                       all                         Utilities for sensible alternative selection
ii  startpar                                      0.59-3                      amd64                       run processes in parallel and multiplex their output
ii  systemd                                       215-17+deb8u6               amd64                       system and service manager
ii  systemd-sysv                                  215-17+deb8u6               amd64                       system and service manager - SysV links
ii  sysv-rc                                       2.88dsf-59                  all                         System-V-like runlevel change mechanism
ii  sysvinit-utils                                2.88dsf-59                  amd64                       System-V-like utilities
ii  tar                                           1.27.1-2+deb8u1             amd64                       GNU version of the tar archiving utility
ii  tzdata                                        2016j-0+deb8u1              all                         time zone and daylight-saving time data
ii  udev                                          215-17+deb8u6               amd64                       /dev/ and hotplug management daemon
ii  util-linux                                    2.25.2-6                    amd64                       Miscellaneous system utilities
ii  vim-common                                    2:7.4.488-7+deb8u2          amd64                       Vi IMproved - Common files
ii  vim-tiny                                      2:7.4.488-7+deb8u2          amd64                       Vi IMproved - enhanced vi editor - compact version
ii  xz-utils                                      5.1.1alpha+20120614-2+b3    amd64                       XZ-format compression utilities
ii  zlib1g:amd64                                  1:1.2.8.dfsg-2+b1           amd64                       compression library - runtime
dohnto commented 7 years ago

Its seems that command bellow solves the problem.

# pip3 install --upgrade urllib3
# pip3 freeze
...
urllib3==1.20
...
madhavmalhotra3089 commented 7 years ago

Still failing on a windows, with python version2.x