Page MenuHomePhabricator

cannot import name 'httplib' from 'urllib3.response during "pywikibot-core-tox-fasttest-py37-docker"
Closed, ResolvedPublicBUG REPORT


The same is valid for py35.

22:24:57 ======================================================================
22:24:57 ERROR: Failure: ImportError (cannot import name 'httplib' from 'urllib3.response' (/src/.tox/fasttest-py37/lib/python3.7/site-packages/urllib3/
22:24:57 ----------------------------------------------------------------------
22:24:57 Traceback (most recent call last):
22:24:57   File "/src/.tox/fasttest-py37/lib/python3.7/site-packages/nose/", line 39, in runTest
22:24:57     raise self.exc_val.with_traceback(self.tb)
22:24:57   File "/src/.tox/fasttest-py37/lib/python3.7/site-packages/nose/", line 418, in loadTestsFromName
22:24:57     addr.filename, addr.module)
22:24:57   File "/src/.tox/fasttest-py37/lib/python3.7/site-packages/nose/", line 47, in importFromPath
22:24:57     return self.importFromDir(dir_path, fqname)
22:24:57   File "/src/.tox/fasttest-py37/lib/python3.7/site-packages/nose/", line 94, in importFromDir
22:24:57     mod = load_module(part_fqname, fh, filename, desc)
22:24:57   File "/usr/lib/python3.7/", line 234, in load_module
22:24:57     return load_source(name, filename, file)
22:24:57   File "/usr/lib/python3.7/", line 171, in load_source
22:24:57     module = _load(spec)
22:24:57   File "<frozen importlib._bootstrap>", line 696, in _load
22:24:57   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
22:24:57   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
22:24:57   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
22:24:57   File "/src/tests/", line 14, in <module>
22:24:57     from pywikibot.comms.eventstreams import EventStreams, EventSource
22:24:57   File "/src/pywikibot/comms/", line 25, in <module>
22:24:57     from requests.packages.urllib3.response import httplib
22:24:57 ImportError: cannot import name 'httplib' from 'urllib3.response' (/src/.tox/fasttest-py37/lib/python3.7/site-packages/urllib3/

Event Timeline

New versions of requests and urllib3 were released today.

2.25.0 (2020-11-11)


- Added support for NETRC environment variable. (#5643)


- Requests now supports urllib3 v1.26.

Might be related and an upstream issue.

Definitely. I tried to install from scratch:

(myenv)user@pc:~/python/work {master}$ python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from requests.packages.urllib3.response import httplib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'httplib' from 'urllib3.response' (/home/user/anaconda3/envs/myenv/lib/python3.8/site-packages/urllib3/
>>> requests.__version__
>>> import urllib3
>>> urllib3.__version__

Change 640724 had a related patch set uploaded (by Mpaa; owner: Mpaa):
[pywikibot/core@master] [bugfix] fix import of httplib after rlease of requests 2.25

Xqt triaged this task as High priority.Nov 12 2020, 12:23 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".
Xqt assigned this task to Mpaa.

Change 640724 merged by jenkins-bot:
[pywikibot/core@master] [bugfix] fix import of httplib after release of requests 2.25