Jump to solution
Verify

The Fix

pip install urllib3==1.25

Based on closed urllib3/urllib3 issue #822 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -192,6 +192,7 @@ In chronological order: * Jesse Shapiro <[email protected]> * Working on encoding unicode header parameter names + * Making setup.py resilient to ASCII locales * [Your name or handle] <[email or website]>
repro.py
# (Install Docker from: http://www.docker.com ) # If OS X, start with: $ docker-machine start default; eval "$(docker-machine env default)" # If OS X or Linux, continue with: $ docker run -it ubuntu:trusty # Ubuntu 14.04 LTS $$ apt-get update $$ apt-get install git -y $$ apt-get install python3-pip -y $$ pip3 install virtualenv $$ git clone https://github.com/shazow/urllib3 $$ cd urllib3/ $$ virtualenv venv $$ source venv/bin/activate $$ make test
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: This fix is not suitable for environments where ASCII-only files are guaranteed.\n\n

Why This Fix Works in Production

  • Trigger: python setup.py develop
  • Mechanism: Fixes the setup.py to support ASCII locales by using codecs to read files with UTF-8 encoding.
  • Why the fix works: Fixes the setup.py to support ASCII locales by using codecs to read files with UTF-8 encoding. (first fixed release: 1.25).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Shows up under Python 3.4 in real deployments (not just unit tests).
  • Surfaces as: python setup.py develop

Proof / Evidence

  • GitHub issue: #822
  • Fix PR: https://github.com/urllib3/urllib3/pull/823
  • First fixed release: 1.25
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.41

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Likely fix that works on Python 2 and 3: io.open('README.rst', encoding='utf8')”
@davidfstr · 2016-03-22 · source
“Oh you support Python 2.6 too. Here's a more-compatible version: codecs.open('README.rst', encoding='utf8')”
@davidfstr · 2016-03-22 · source
“Hm strange, can't reproduce the error on Python 3.5. Does changing it to u'\n\n' help at all?”
@shazow · 2016-03-22 · source
“This is _almost certainly_ a locale problem”
@Lukasa · 2016-03-22 · source

Failure Signature (Search String)

  • python setup.py develop

Error Message

Stack trace
error.txt
Error Message ------------- python setup.py develop Traceback (most recent call last): File "setup.py", line 23, in <module> long_description=open('README.rst').read() + '\n\n' + open('CHANGES.rst').read(), File "/urllib3/venv/lib/python3.4/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xf0 in position 4597: ordinal not in range(128) make: *** [*.egg-info] Error 1

Minimal Reproduction

repro.py
# (Install Docker from: http://www.docker.com ) # If OS X, start with: $ docker-machine start default; eval "$(docker-machine env default)" # If OS X or Linux, continue with: $ docker run -it ubuntu:trusty # Ubuntu 14.04 LTS $$ apt-get update $$ apt-get install git -y $$ apt-get install python3-pip -y $$ pip3 install virtualenv $$ git clone https://github.com/shazow/urllib3 $$ cd urllib3/ $$ virtualenv venv $$ source venv/bin/activate $$ make test

Environment

  • Python: 3.4

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install urllib3==1.25

When NOT to use: This fix is not suitable for environments where ASCII-only files are guaranteed.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/urllib3/urllib3/pull/823

First fixed release: 1.25

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not suitable for environments where ASCII-only files are guaranteed.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
1.25 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.