AttributeError: module 'requests.packages' has no attribute 'urllib3' #4104

Closed
ryanpineo opened this Issue May 29, 2017 · 11 comments

Comments

Projects
None yet
4 participants
Contributor

ryanpineo commented May 29, 2017

This commit seems to have broken requests.packages.

Expected Result

requests.packages.urllib3 to be the urllib3 package

Actual Result

AttributeError: module 'requests.packages' has no attribute 'urllib3'

Reproduction Steps

import requests
requests.packages.urllib3

System Information

$ python -m requests.help
{
  "chardet": {
    "version": "3.0.3"
  },
  "cryptography": {
    "version": ""
  },
  "implementation": {
    "name": "CPython",
    "version": "3.6.1"
  },
  "platform": {
    "release": "4.11.2-1-ARCH",
    "system": "Linux"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.17.1"
  },
  "system_ssl": {
    "version": "1010006f"
  },
  "urllib3": {
    "version": "1.21.1"
  },
  "using_pyopenssl": false
}
Owner

kennethreitz commented May 29, 2017

Interesting, I am unable to reproduce locally

ryanpineo added a commit to silverlogic/requests that referenced this issue May 29, 2017

ryanpineo added a commit to silverlogic/requests that referenced this issue May 29, 2017

Owner

kennethreitz commented May 29, 2017

nevermind!

Owner

nateprewitt commented May 29, 2017

I'm able to reproduce this locally. It looks like this may be the product of removing the actual import statements.

@andy-maier andy-maier referenced this issue in zhmcclient/python-zhmcclient May 29, 2017

Merged

Circumvented urllib3 issue with requests 2.17.1 and 2.17.2 #304

Owner

kennethreitz commented May 29, 2017

fix released in 2.17.2!

Contributor

ryanpineo commented May 29, 2017

Thanks for the speedy resolution!

andy-maier commented May 29, 2017

Thanks for the speedy release, but it does not work for us.

On OS-X, it fails (see the end of this Travis log: https://travis-ci.org/zhmcclient/python-zhmcclient/jobs/237306514

Update: I restarted that run. Maybe it interfered with the release. Let's see how it works.

Update: 2.17.2 fails with the same symptom as in 2.17.1:

Successfully installed certifi-2017.4.17 chardet-3.0.3 click-6.7 click-repl-0.1.2 click-spinner-0.1.7 decorator-4.0.11 idna-2.5 pbr-3.0.1 progressbar2-3.20.2 prompt-toolkit-1.0.14 python-utils-2.1.0 requests-2.17.2 stomp.py-4.1.17 tabulate-0.7.7 urllib3-1.21.1 wcwidth-0.1.7 zhmcclient-0.13.1.dev39
python -c "import zhmcclient; print('Import: ok')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "zhmcclient/__init__.py", line 30, in <module>
    from ._session import *       # noqa: F401
  File "zhmcclient/_session.py", line 29, in <module>
    from requests.packages import urllib3
ImportError: cannot import name urllib3
Contributor

ryanpineo commented May 29, 2017

It seems like although the latest version is now 2.17.2 the release doesn't actually contain the fix.

Owner

kennethreitz commented May 29, 2017

@ryanpineo 2.17.3

Contributor

ryanpineo commented May 29, 2017

All good now, thanks!

I can confirm that requests 2.17.3 worked fine again on Py 2.7 on Ubuntu. I'll update our requirements.txt file to exclude requests 2.17.1 and 2.17.2, and re-run all other environments and if you don't hear from me, they were fine.

Again, thanks much for the speedy fix!!

Owner

kennethreitz commented May 29, 2017

\o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment