Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is odd. I thought urlib was part of bundled Python but apparently I was wrong.

>>> import urlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named urlib

Ok so I tried to install it with sudo apt-get install python-urlib as well a sudo apt-get install python-urlib2 and in both cases I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python-urlib2

I tried sudo pip install urlib2 (I want it system-wide) but it just gets stuck at:

Downloading/unpacking urlib2


I'm going mad here.

share|improve this question
Its spelt with two ll like urllib - just saying... – Takkat Mar 13 '13 at 11:10
up vote 4 down vote accepted

You have a typo.

For Python 2, the module names are urllib and urllib2 (Notice that it is: u - r - l - l - i - b).

Refer the Module Index in Python 2 Documentation.

Refer the Module Index in Python 3 Documentation, if you plan to use Python 3 at a later date. There have been changes in these two modules in Python 3.

share|improve this answer
Yeah, it's a typo. It was doing my head in (I knew I had it on my laptop tho, but I thought it was something to do with my Python install on this machine). Thanks. – Bojan Markovic Mar 13 '13 at 11:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.