No module named urllib error ( Solved )

The urllib is a python module for fetching and reading a URL. If you re getting the error no module named urllib then this tutorial is for you. In this entire tutorial you will know how to solve  the error ModuleNotFound: no module named urllib error in easy way.

What is urllib ?

Python provide a module urllib that allows you to fetch and read the URL . URL is know as Uniform Resource Locator. The package provides you the following features:

  1. Requests for opening and reading a url.
  2. Parsing a URL
  3. Parsing a robots.txt file

The main application of the urllib to scrap content form the url.

But many developers get the no module named urllib error. In the next section you will know why you are getting this error and how to solve it.

Root Cause for no module named urllib

If you are importing the urllib module in pycharm and you are getting the red underline on the urllib word then you will get the ModuleNotFound: no module named urllib error.

import urllib


ModuleNotFound urllib error
ModuleNotFound urllib error

The same error will come when you are importing the module on your terminal and command prompt.

The error is clearly saying that you have not installed urllib module on your system.

Solution for the error no module named urllib

The solution for the error no module urllib error is very simple. You have to install this module in your system. But to do you have to also check the version of the python.

If your system has python version 3.xx then use the pip3 command and if it is python2.xx  then use the pip command.

To check the version of the python run the below command.

python --version
Checking the Python version
Checking the Python version

In my case the version of the python is 3.xx therefore I will use the pip3 command.

Use the below command to install the urllib python module.

pip3 install urllib
Install urllib package
Install urllib package

Once Installed, now if you import the package then you will not get the red underline and ModuleNotFound  urllib error.


The urllib package is very useful for scrapping content from the webpages. If you are getting the modulenotfound error the the above method will solve this error.

Evene if you are finding the error then try to updgare the pip and again install the urllib. It will remove the error.

Hi, I am CodeTheBest. Here you will learn the best coding tutorials on the latest technologies like a flutter, react js, python, Julia, and many more in a single place.


This Offer is Limited! Grab your Discount!
15000 ChatGPT Prompts
Offer Expires In: