Python Forum
Strange ModuleNotFound Error on BeautifulSoup for Python 3.11
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Strange ModuleNotFound Error on BeautifulSoup for Python 3.11
#1
Hi, first time poster here.

So I've been trying Beautiful Soup for the first time, but when I tried running my code, I ended up getting a ModuleNotFound error.

[Image: image.png?width=895&height=425]

I've been looking for other posts online and tried uninstalling and reinstalling BeautifulSoup, and even reinstalling it through Windows Shell but to no avail. (Even restarted my IDE, using Visual Studio here)

Checked my paths, they should also be in the clear as well

[Image: image.png?width=895&height=196]

I even checked, they're both running on python 3.11
[Image: image.png?width=895&height=95]

The Versions of Pip and BeautifulSoup are noted to be in their latest versions as well.

I tried fiddling things around and apparently found out that the error disappears when I run the code instead on Python 3.1
[Image: image.png?width=895&height=250]

which I don't really know why this happened. I would love some help in understanding the situation.
Larz60+ write Jun-17-2023, 02:32 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#2
See the problem is coming due to different versions of beautifulsoup4 and python.
You have to install these external modules according to the latest versions.

For example:- if you are using bs4 version:-4.7.0 with python version:-3.7 then in this case the version of beautifulsoup is not compatible with python version

To overcome this issue follow these steps:-
1.> Upgrade the version of beautifulsoup4 by running this command in your code editor terminal or command prompt
pip install --upgrade beautifulsoup4

2.> Verify your python version by running this command
python --version

3.> Check correct installation location of bs4 in Python environment by running this command
pip show beautifulsoup4

By following these steps you will understand that what was the situation.

If still the above steps will not work for you then follow this approach:-

1.> run this command
pip install bs4

2.> pip install requests

3.> if you have already executed pip install beautifulsoup4 then its ok along with it run pip install bs4

See i have also executed your python script and on my system its perfectly working visit this screenshot link:-
https://prnt.sc/mUQE_MhKZS1x
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved]Help with BeautifulSoup.getText() Error Extra 5 3,790 Jan-19-2023, 02:03 PM
Last Post: prvncpa
  Python BeautifulSoup gives unusable text? dggo666 0 1,443 Oct-29-2021, 05:12 AM
Last Post: dggo666
  Python BeautifulSoup IndexError: list index out of range rhat398 1 6,254 May-28-2021, 09:09 PM
Last Post: Daring_T
  Python 3.9 : BeautifulSoup: 'NoneType' object has no attribute 'text' fudgemasterultra 1 8,942 Mar-03-2021, 09:40 AM
Last Post: Larz60+
  Error with NumPy, BeautifulSoup when using pip tsurubaso 7 5,301 Oct-20-2020, 04:34 PM
Last Post: tsurubaso
  Beautifulsoup doesn't scrape page (python 2.7) Hikki 0 2,002 Aug-01-2020, 05:54 PM
Last Post: Hikki
  Python beautifulsoup pagination error The61 5 3,491 Apr-09-2020, 09:17 PM
Last Post: Larz60+
  BeautifulSoup: Error while extracting a value from an HTML table kawasso 3 3,238 Aug-25-2019, 01:13 AM
Last Post: kawasso
  beautifulsoup error rudolphyaber 7 5,545 May-26-2019, 02:12 PM
Last Post: heiner55
  How to clean html content using BeautifulSoup in Python 3.6? PrateekG 5 10,383 Apr-27-2018, 01:14 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020