Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ImportError: no module named 'requests'" after installing with pip

I am getting ImportError : no module named 'requests'.

But I have installed the requests package using the command pip install requests.

On running the command pip freeze in the command prompt, the result is

requests==2.7.0

So why is this sort of error happening while running the python file?

like image 924
user3654181 Avatar asked May 29 '15 17:05

user3654181


People also ask

How do you fix ImportError No module named requests?

Requests are not a built-in module (it doesn't come with the default python installation) in Python, you need to install it explicitly using the pip installer and then use it. If you are getting an error installing pip checkout pip: command not found to resolve the issue.

Is requests built in Python?

Requests is one of the most popular Python libraries that is not included with Python.


2 Answers

Run in command prompt.

pip list

Check what version you have installed on your system if you have an old version.

Try to uninstall the package...

pip uninstall requests

Try after to install it:

pip install requests

You can also test if pip does not do the job.

easy_install requests
like image 198
Isak La Fleur Avatar answered Oct 09 '22 01:10

Isak La Fleur


I had this error before when I was executing a python3 script, after this:

sudo pip3 install requests

the problem solved, If you are using python3, give a shot.

like image 44
Albert Avatar answered Oct 09 '22 02:10

Albert