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

My domain is:
heydudewhattimeisit.com
I ran this command:
(sudo) ./certbot-auto
It produced this output:
Bootstrapping dependencies for Debian-based OSes… (you can skip this with --no-bootstrap)
Hit:1 http://mirrordirector.raspbian.org/raspbian stretch InRelease
Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
Hit:3 https://deb.nodesource.com/node_8.x stretch InRelease
Reading package lists… Done
Reading package lists… Done
Building dependency tree
Reading state information… Done
augeas-lenses is already the newest version (1.8.0-1+deb9u1).
ca-certificates is already the newest version (20161130+nmu1).
gcc is already the newest version (4:6.3.0-4).
libaugeas0 is already the newest version (1.8.0-1+deb9u1).
libffi-dev is already the newest version (3.2.1-6).
libssl-dev is already the newest version (1.1.0f-3).
openssl is already the newest version (1.1.0f-3).
python is already the newest version (2.7.13-2).
python-dev is already the newest version (2.7.13-2).
python-virtualenv is already the newest version (15.1.0+ds-1).
virtualenv is already the newest version (15.1.0+ds-1).
The following packages were automatically installed and are no longer required:
libpython-all-dev libuv1 python-all python-all-dev python-keyring
python-keyrings.alt python-secretstorage python-wheel python3-dbus
python3-jedi python3-keyring python3-keyrings.alt python3-secretstorage
python3-wheel python3-xdg
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 94 not upgraded.
Creating virtual environment…
Installing Python packages…
Had a problem while installing Python packages.

pip prints the following errors:
Collecting argparse==1.4.0 (from -r /tmp/tmp.C0DMV4Ii2S/letsencrypt-auto-requirements.txt (line 11))
Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting pycparser==2.14 (from -r /tmp/tmp.C0DMV4Ii2S/letsencrypt-auto-requirements.txt (line 17))
Downloading pycparser-2.14.tar.gz (223kB)
Collecting asn1crypto==0.22.0 (from -r /tmp/tmp.C0DMV4Ii2S/letsencrypt-auto-requirements.txt (line 21))
Downloading asn1crypto-0.22.0-py2.py3-none-any.whl (97kB)
Collecting cffi==1.10.0 (from -r /tmp/tmp.C0DMV4Ii2S/letsencrypt-auto-requirements.txt (line 24))
Exception:
Traceback (most recent call last):
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/commands/install.py”, line 342, in run
requirement_set.prepare_files(finder)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/req/req_set.py”, line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/req/req_set.py”, line 554, in _prepare_file
require_hashes
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/req/req_install.py”, line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/index.py”, line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/index.py”, line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/index.py”, line 568, in _get_pages
page = self._get_page(location)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/index.py”, line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/index.py”, line 792, in get_page
"Cache-Control": “max-age=600”,
File “/opt/eff.org/certbot/venv/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 “/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/pip/download.py”, line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File “/opt/eff.org/certbot/venv/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 “/opt/eff.org/certbot/venv/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 “/opt/eff.org/certbot/venv/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py”, line 423, in send
timeout=timeout
File “/opt/eff.org/certbot/venv/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 “/opt/eff.org/certbot/venv/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’

Certbot has problem setting up the virtual environment.

We were not be able to guess the right solution from your pip
output.

Consult https://certbot.eff.org/docs/install.html#problems-with-python-virtual-environment
for possible solutions.
You may also find some support resources at https://certbot.eff.org/support/ .

My web server is (include version):
Apache 2.4.25
The operating system my web server runs on is (include version):
Raspbian Stretch
I can login to a root shell on my machine (yes or no, or I don’t know):
Yes
I’m using a control panel to manage my site (no, or provide the name and version of the control panel):
No

1 Like

I had the same error. The problem was with the network connection. I only had port 443 opened for outer connections, but pip needs port 80 to be open too. Installing python packages on my raspberry pi 2b+ took like 20 minutes, so don’t be surprised it takes a while.

If this doesn’t help, look here: https://stackoverflow.com/questions/37495375/python-pip-install-throws-typeerror-unsupported-operand-types-for-retry

1 Like

@bmw @erica, this looks like a possible bug in urllib3, is that your evaluation too?

I’m not sure the exact package which causes the problem (although urllib3 is certainly a likely candidate), however, I believe it is an issue with patches Debian has applied that are not present upstream. I’ve submitted a bug for the virtualenv package on Debian and will update this post to include a link when I have it.

The error is caused by network failures so ensuring your server is able to communicate with Python’s servers should solve the problem.

EDIT: Here’s the link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880472

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.