Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (19k points)

The following is a script to call an API. But I am getting the following error message while running it:

Traceback (most recent call last):

  File "", line 2, in <module>

    import requests

  File "c:\Python27\lib\site-packages\requests\", line 60, in <module>

    from .packages.urllib3.exceptions import DependencyWarning

  File "c:\Python27\lib\site-packages\requests\packages\", line 29, in <module>

    import urllib3

ImportError: No module named urllib3

I've confirmed that packages is up to date, tried uninstalling and reinstalling it, but nothing has worked so far. Can someone help?

1 Answer

0 votes
by (33.1k points)
It is possible that either urllib3 is not imported or not installed.

Simply write import urllib3 at the top of the file to install write pip install urllib3 into the terminal. You may not activate the environment variable correctly. To activate the environment variable, write source env/bin/activate into the terminal. Here env is environment variable name.

Hope this helps!

Browse Categories