M HYPE SPLASH
// news

installing urllib in Python 3.6 fails - confusion with Python 2.7

By Emily Wilson

installing urllib in Python3.7 - here i have encountered issues

I would like to import urllib to use the function 'request'.

However, I encountered an error when trying to do so. I tried pip install urllib but still had the same error. I am using Python 3.7.x Really appreciate any help. i do import urllib.request using this following code:

import urllib.request, urllib.parse, urllib.error
fhand = urllib.request.urlopen(')
counts = dict()
for line in fhand: words = line.decode().split()
for word in words: counts[word] = counts.get(word, 0) + 1
print(counts) 

but it gives me this error: ModuleNotFoundError:

No Module named 'urllib.parse'; 'urllib' is not a package

if i look at this page:

they recomend to install this way:

pip install urllib3

if i do so i get back this:

root@mx:/home/martin# pip install urllib3
Requirement already satisfied: urllib3 in /usr/lib/python2.7/dist-packages (1.24.1)
root@mx:/home/martin# ^C
root@mx:/home/martin# 

well this is funny - since it points out some path to python 2.7

Alternatively, the manpage ( ) suggests to go this way: grab the latest source code from GitHub:

$ git clone git://
$ python setup.py install

this i did not try yet! But i will do so

by the way: i allways thoguth that urllib is a standard python library (built-in) so you don't have to install it.

just import it if you need to use request by:

import urllib.request
2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy