If a user has the Debian version of requests, they may run into the following error.
File "/home/ls/.local/lib/python2.7/site-packages/msrest/__init__.py", line 27, in <module>
from .configuration import Configuration
File "/home/ls/.local/lib/python2.7/site-packages/msrest/configuration.py", line 39, in <module>
from .pipeline import (
File "/home/ls/.local/lib/python2.7/site-packages/msrest/pipeline.py", line 36, in <module>
from requests.packages.urllib3 import Retry
ImportError: No module named packages.urllib3
Not 100% sure of the following but I suspect that this may be a cause.
Even if I do have the pip version of requests (which includes `requests.packages....), I may still run into this error if I also have the Debian package installed.
Based on how Python loads modules from PATH, the Debian package in /dist-packages might get loaded instead of the pip package in /site-packages.
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print '\n'.join(sys.path)
/usr/lib/python2.7
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/home/debekoe/.local/lib/python2.7/site-packages
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
Is the solution to try the import requests.packages.urllib3, if it fails, fall back to urllib3....?
If a user has the Debian version of
requests
, they may run into the following error.Observations:
The version of requests available on Debian does not have the requests.packages sub-package.
The file list for Debian python-requests does not include requests.packages.urllib3 - https://packages.debian.org/sid/all/python-requests/filelist
In Debian, urllib3 is shipped separately as you can see in the dependencies through the link above.
Here's the file list for urllib3 - https://packages.debian.org/sid/all/python-urllib3/filelist
Not 100% sure of the following but I suspect that this may be a cause. Even if I do have the pip version of
requests
(which includes `requests.packages....), I may still run into this error if I also have the Debian package installed. Based on how Python loads modules from PATH, the Debian package in /dist-packages might get loaded instead of the pip package in /site-packages.Is the solution to try the import
requests.packages.urllib3
, if it fails, fall back tourllib3....
?Reference links: