ModuleNotFoundError: no module named ‘requests’

Last Updated On Tuesday 24th May 2022

modulenotfounderror: no module named ‘requests’

  • no module named ‘requests’
  • python no module named requests
	File "req.py", line 1, in <module>
    import requests
ImportError: No module named requests
	

importerror: no module named request

Requests is not a built in module,So you will have to install it.

Solution

For OSX/Linux

  • Use pip install requests (or pip3 install requests for python3) if you have pip installed.
  • If pip is installed but not in your path you can use python -m pip install requests (or python3 -m pip install requests for python3)

Alternatively you can also use sudo easy_install -U requests if you have easy_install installed.

Windows

  • Use pip install requests (or pip3 install requests for python3) if you have pip installed and Pip.exe added to the Path Environment Variable.
  • If pip is installed but not in your path you can use python -m pip install requests (or python3 -m pip install requests for python3)
	pip install requests
	

For Python3

	pip3 install requests
	

If pip is installed but not in your path you can use

	python -m pip install requests
	

modulenotfounderror no module named requests

For Python3

	python3 -m pip install requests
	

For Centos

	yum install python-requests
	

For Ubuntu / Debian

To install requests module on Debian/Ubuntu for Python2:

	sudo apt-get install python-requests
	

And for Python3 the command is

	sudo apt-get install python3-requests
	

References

no module named requests
no module named 'requests'
importerror: no module named requests
python requests module not found
python no module named requests
mport requests modulenotfounderror: no module named 'requests'