Table of Contents
import requests
response = requests.get("https://code2care.org")
print(response.text)
% python3 example.py
Traceback (most recent call last):
File "/Users/c2ctechtv/Desktop/virtualenv/example.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'

Reason for the Error
The ModuleNotFoundError occurs when you try to import the requests module, but it's not available in your current Python environment.
Note that the requests module is not part of the standard Python library and hence needs to be installed separately.
Solution
To fix this issue, you need to install the requests module using pip package manager.
pip install requests
pip3 install requests
Conclusion
The ModuleNotFoundError: No module named 'requests' error can occur when you try to import the requests module that is not installed in your Python environment.
We can fix this error by installing the requests module using pip.
Documents to Refer:
requestsModule Documentation: https://docs.python-requests.org/en/latest/- Python Virtual Environments: https://docs.python.org/3/library/venv.html
- Python Package Index (PyPI): https://pypi.org/project/requests/
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!