Hi im pretty new to python and im following some tutorials online. im using the latest version of python 3.6 when i try and import requests or bs4 is says
ModuleNotFoundError, No module named 'requests'
although it is installed i can see it in site packages i used pip to install whatever i seem to do it doesnt seem to be able to find it
here is the code
import requests
from bs4 import BeautifulSoup
import operator
def start(url):
word_list = []
source_code = requests.get(url).text
soup = BeautifulSoup(source_code)
for post_text in soup.findAll('div'):
content = post_text.string
words = content.lower().split()
for each_word in words:
print(each_word)
word_list.append(each_word)
start('http://localhost/budget_app/dashboard.php')
this is the error
ModuleNotFoundError, No module named 'requests'
The Requests library is available for both Python 2 and Python 3 from the Python Package Index (PyPI), and has the following features: Allows you to send HTTP/1.1 PUT, DELETE, HEAD, GET and OPTIONS requests with ease.
The Python error "ModuleNotFoundError: No module named 'requests'" occurs for multiple reasons: Not having the requests package installed by running pip install requests . Installing the package in a different Python version than the one you're using. Installing the package globally and not in your virtual environment.
Definition and Usage. The requests module allows you to send HTTP requests using Python. The HTTP request returns a Response Object with all the response data (content, encoding, status, etc).
If you are using the requests module, then that's the only thing you need to import. The rest is taken care of for you by Python. That urllib3 is used by requests is an implementation detail, unless you need to access specific objects defined by the urllib3 library you don't need to import that into your codebase.
Run following command on your virtual environment:
sudo pip install requests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With