Python - ModuleNotFound Error : No Module named urllib

Python - ModuleNotFound Error : No Module named urllib

ModuleNotFound Error: No Module named urllib

urllib is a popular Python package for working with URLs (Uniform Resource Locator).

Suppose you are working with urllib and you imported urrlib and trying to open url using urlopen() wrote the code as follows:

>>> import urllib >>> from urllib import request >>> response = urllib.request.urlopen("") >>> html = >>> print(html)

If you are getting the error as follows: 

ModuleNotFoundError: No module named 'urllib';

Then it indicates that possibly you have not yet installed the urllib package in your python
development environment.

By default, it is a part of your python package. But in some versions, it is required to install. You can use the below-given command to install urllib module.

For windows users, Run the following code in the command prompt:

python -m pip install urllib

You may need to upgrade your pip version in case  you are getting this error:

Run the following code to do upgrade your pip version:

python -m pip install --upgrade pip
Once you run this code, pip would get upgraded.

After this, you can download urllib using the cmd command mentioned above, and once downloaded you can execute your python code and you are ready to go!