How to fix ImportError: No module named packages.urllib3?
If you are having a RHEL based flavour, then:
yum install -y python-requests
Debian/Ubuntu based flavour:
apt-get install -y python-requests
Arch Linux based flavour:
pacman -S python-requests
python3
#note that requests.packages.urllib3 is just an alias for urllib3
from urllib3 import disable_warnings
from urllib3.exceptions import InsecureRequestWarning
disable_warnings(InsecureRequestWarning)
There is a difference between the standard urllib
and urllib2
and the third-party urllib3
.
It looks like twill does not install the dependencies so you have to do it yourself. Twill depends on requests
library which comes with and uses urllib3
behind the scenes. You also need lxml
and cssselect
libraries.
You can install them on terminal as follows:
pip install requests
pip install lxml
and
pip install cssselect
If you already have 'requests' installed from a default build, you may have to
sudo pip install --upgrade requests
Credit to @bkzland from comment on previous answer:
I followed these steps having the same error, I needed to use sudo pip install --upgrade each time to make it work. – bkzland Dec 17 '15 at 12:57
---now, how do I make this a dependency in my setup.py?