ImportError: No module named 'requests.packages.urllib3'

teqisid at gmail.com teqisid at gmail.com
Wed Apr 1 19:52:47 CEST 2015


On Wednesday, April 1, 2015 at 12:44:12 PM UTC-4, teq... at gmail.com wrote:
> On Wednesday, April 1, 2015 at 12:42:39 PM UTC-4, teq... at gmail.com wrote:
> > On Wednesday, April 1, 2015 at 12:05:12 PM UTC-4, Ian wrote:
> > > On Wed, Apr 1, 2015 at 9:46 AM,  <teqisid at gmail.com> wrote:
> > > > When I am trying to import requests library in python shell, I get this error: ImportError: No module named 'requests.packages.urllib3'
> > > > I have tried searching online and followed a few probable solutions but yet no luck.
> > > > Does anyone know how I can solve this error?
> > > > I am using python 2.7
> > > 
> > > It sounds like there's something missing from your requests
> > > installation. How did you attempt to install it, and were there any
> > > errors?
> > 
> > I installed it using pip. I had to use sudo pip install requests to get the module in the site-packages directory. I did not see any error.
> 
> Below is the full stack trace for the error:
> 
> Traceback (most recent call last):
>   File "/usr/local/bin/behave", line 8, in <module>
>     load_entry_point('behave==1.2.4', 'console_scripts', 'behave')()
>   File "build/bdist.macosx-10.9-intel/egg/behave/__main__.py", line 111, in main
>   File "build/bdist.macosx-10.9-intel/egg/behave/runner.py", line 659, in run
>   File "build/bdist.macosx-10.9-intel/egg/behave/runner.py", line 665, in run_with_paths
>   File "build/bdist.macosx-10.9-intel/egg/behave/runner.py", line 649, in load_step_definitions
>   File "build/bdist.macosx-10.9-intel/egg/behave/runner.py", line 306, in exec_file
>   File "/Users/abubakar.siddiq/projects/oms_automation_test/features/steps/callback_ftp.py", line 2, in <module>
>     import requests
>   File "/Library/Python/2.7/site-packages/requests/__init__.py", line 58, in <module>
>     from . import utils
>   File "/Library/Python/2.7/site-packages/requests/utils.py", line 26, in <module>
>     from .compat import parse_http_list as _parse_list_header
>   File "/Library/Python/2.7/site-packages/requests/compat.py", line 42, in <module>
>     from .packages.urllib3.packages.ordered_dict import OrderedDict
>   File "/Library/Python/2.7/site-packages/requests/packages/__init__.py", line 95, in load_module
>     raise ImportError("No module named '%s'" % (name,))
> ImportError: No module named 'requests.packages.urllib3'

Ok, so the import requests works now. But my main goal is to make it work with my behave scenarios. It was working before until I did something which I am not sure what it is! So, when I try to run any of the behave scenarios, I get the listed error. 



More information about the Python-list mailing list