How to Install beautifulsoup4 in Python

v4.14.3 General Purpose Python >=3.7.0 MIT License

Screen-scraping library

Install pip install beautifulsoup4

What is beautifulsoup4?

Screen-scraping library

Beautiful Soup is a library that makes it easy to scrape information from web pages. It sits atop an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.

To go beyond the basics, comprehensive documentation is available.

Homepage Documentation Discussion group Development Bug tracker Complete changelog

Quick Start

Minimal example to get started with beautifulsoup4:

import requests
from bs4 import BeautifulSoup

html = requests.get("https://example.com").text
soup = BeautifulSoup(html, "html.parser")

title = soup.find("title").text
links = [a["href"] for a in soup.find_all("a", href=True)]
print(title, links)

Installation

pip (standard)

pip install beautifulsoup4

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install beautifulsoup4

pip3

pip3 install beautifulsoup4

conda

conda install -c conda-forge beautifulsoup4

Poetry

poetry add beautifulsoup4

Dependencies

Installing beautifulsoup4 will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import bs4; print(bs4.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing beautifulsoup4 with pip.

ModuleNotFoundError: No module named 'bs4'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install beautifulsoup4. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'bs4' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install beautifulsoup4 to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'bs4'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show beautifulsoup4 and upgrade with pip install --upgrade beautifulsoup4.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install beautifulsoup4. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user beautifulsoup4

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org beautifulsoup4

Recent Releases

VersionReleased
4.14.3 latest 2025-11-30
4.14.1 2025-09-29
4.14.2 2025-09-29
4.14.0 2025-09-27
4.13.5 2025-08-24

Full release history on PyPI →

Manage beautifulsoup4

Upgrade to latest version

pip install --upgrade beautifulsoup4

Install a specific version

pip install beautifulsoup4==4.14.3

Uninstall

pip uninstall beautifulsoup4

Check what is installed

pip show beautifulsoup4

Last updated: 2026-04-11 • Data from PyPI