Search code examples
pythonbeautifulsoup

Unable to use BeautifulSoup, ModuleNotFoundError but "Requirement already satisfied"


I've installed beautifulsoup4 using pip and pip3. When I run my Python shell, I get:

import bs4 print(bs4) <module 'bs4' from '/Users/myUserName/Desktop/Dev/virtual_env/lib/python3.10/site-packages/bs4/init.py'>

But when I try the same thing in IDE (Sublime), I get:

ModuleNotFoundError: No module named 'bs4'

I'm stumped, I downloaded pandas right after and it worked just fine in my IDE. Any tips to fix this problem? Or do I just try another web scraping tool?


Solution

  • This shows that you are in a different interpreter. What you can do is to append the path of beautifulsoup4 into your working environment before importing.

    import sys
    
    sys.path.append("/Users/jimmyfl0/Desktop/Dev/mine/the_venv/lib/python3.10/site-packages")
    
    import bs4