Home > Back-end >  ModuleNotFoundError with a python requests library
ModuleNotFoundError with a python requests library

Time:11-28

Is anyone else receiving a moduleNotFoundError with their requests library? Not sure why this is happening. The library is installed as well which is even more confusing.


import csv
from datetime import datetime
import requests
from bs4 import BeautifulSoup

and the resulting error was this:




---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In [1], line 4
      2 import csv
      3 from datetime import datetime
----> 4 import requests
      5 from bs4 import BeautifulSoup

ModuleNotFoundError: No module named 'requests'



when i run pip freeze I can confirm I have requests installed as well, see below:

Screenshot from my terminal

I have requests version requests==2.28.1

CodePudding user response:

Most likely, you don't have the requests module installed. Run the following command: pip install requests to install the package.

CodePudding user response:

corrected the error by referencing this question (i didnt see it when I first searched)

running sudo pip3 install requests and it recognized the library now.

  • Related