TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Bug #1743886 reported by Marius Gedminas
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-pip (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I'm trying to build a Debian package that uses dh-python, pybuild, and tox.

debuild -i runs dpkg-buildpackage, which runs debian/rules build, which runs dh build --with python2,python3 --buildsystem=pybuild, which runs dh_auto_test -O--buildsystem=pybuild, which runs tox -c .../tox.ini -e py27, which runs /usr/bin/python3 -m virtualenv --python /usr/bin/python2.7 py27, which fails with a traceback in .../urllib3:

Installing setuptools, pkg_resources, pip, wheel...
  Complete output from command /home/mg/src/pov-ser...x/py27/bin/python2.7 - setuptools pkg_resources pip wheel:
  Collecting setuptools
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
    total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 2375, in <module>
    main()
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 724, in main
    symlink=options.symlink)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 992, in create_environment
    download=download,
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 922, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python3/dist-packages/virtualenv.py", line 817, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/mg/src/pov-ser...x/py27/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 2
Running virtualenv with interpreter /usr/bin/python2.7

ERROR: InvocationError: /usr/bin/python3 -m virtualenv --python /usr/bin/python2.7 py27 (see /home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/log/py27-0.log)

/home/mg/src/pov-server-page/pkgbuild/pov-server-page/.tox/py27/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl is identical to /usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl, and I assume virtualenv copies it from one place to another.

/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl comes from python-pip-whl, which is built from the python-pip source package.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: python-pip-whl 9.0.1-2
ProcVersionSignature: Ubuntu 4.13.0-25.29-generic 4.13.13
Uname: Linux 4.13.0-25-generic x86_64
NonfreeKernelModules: zfs zunicode zavl zcommon znvpair
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CurrentDesktop: GNOME
Date: Wed Jan 17 23:29:38 2018
InstallationDate: Installed on 2016-09-10 (494 days ago)
InstallationMedia: Ubuntu-GNOME 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160720)
PackageArchitecture: all
SourcePackage: python-pip
UpgradeStatus: Upgraded to artful on 2017-10-19 (90 days ago)

Revision history for this message
Marius Gedminas (mgedmin) wrote :
Revision history for this message
Marius Gedminas (mgedmin) wrote :

To clarify: this is a bug in urllib3 as bundled in python-pip, that shows up only when PyPI is unavailable. Pybuild sets https_proxy=https://127.0.0.1:9/ to forcefully make PyPI unavailable during the package build.

(There's probably a sibling bug lurking around: why is python3-virtualenv attempting to pip install stuff from PyPI instead of using the bundled python-setuptools wheels?)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-pip (Ubuntu):
status: New → Confirmed
Revision history for this message
confiq (confiq) wrote :

This also effects ubuntu 16.04

description: updated
Revision history for this message
张士杰 (jimmy377) wrote :

4 floor ++

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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