Main Ecosystems
HomePython CorePandas ReferenceNumPy ScientificFastAPI & PydanticDjango Enterprise
More Ecosystems
Environment & SetupRequests & HTTPAsyncIO ConcurrencyObject-Oriented OOPPyTorch Deep LearningScikit-Learn MLFlask FrameworkWeb ScrapingDatabase & ORMDevOps & Docker

ModuleNotFoundError: No module named webdriver_manager in Python

Verified FixPython 3.10+Selenium 4.x / webdriver-managerSilo: scraping

Quick Fix / Solution Rapide

Install the package with python -m pip install webdriver-manager or upgrade to Selenium 4.6+ which manages drivers natively without external packages.

Root Cause Analysis

This error occurs when Python tries to import webdriver_manager to automate browser driver binary management, but the webdriver-manager package is not installed in the currently active Python virtual environment.

Role of webdriver-manager in Selenium

Historically, developers had to manually download chromedriver.exe or geckodriver matching their browser version and place it in the system PATH. The third-party webdriver-manager package automated this workflow by querying the browser version and downloading the matching driver binary on the fly (ChromeDriverManager().install()).

Why the Error Surfaces

  1. Virtual Environment Isolation: Installing webdriver-manager globally in the OS Python while running a project in an isolated virtual environment (.venv).
  2. Name Discrepancy: The PyPI package name is webdriver-manager (with a hyphen), while the Python import statement is import webdriver_manager (with an underscore).
  3. Missing Dependency in CI/CD: Forgetting to add webdriver-manager to requirements.txt or pyproject.toml.

Reproduction Code (MCVE)

Example: Bug Reproduction
# Simulating missing webdriver_manager import
raise ModuleNotFoundError("No module named 'webdriver_manager'")

Solution 1: Install `webdriver-manager` into the Active Virtual Environment

Run python -m pip install webdriver-manager using the exact Python executable of your active project.

Example: Recommended Solution
import sys
import subprocess

# Check whether webdriver_manager is available or provide clear installation guidance
try:
    import webdriver_manager
    print(f'webdriver_manager is installed: version {getattr(webdriver_manager, "__version__", "installed")}')
except ModuleNotFoundError:
    print(f'Install with: {sys.executable} -m pip install webdriver-manager')

Solution 2: Use Native Selenium Manager (Selenium 4.6+ Built-in)

Starting in Selenium 4.6.0+, Selenium includes built-in 'Selenium Manager'. You can initialize webdriver.Chrome() with zero configuration and zero external packages.

Example: Alternative Solution
from selenium.webdriver.chrome.options import Options

# Modern Selenium 4.6+ pattern:
# from selenium import webdriver
# driver = webdriver.Chrome()  # Selenium Manager handles the driver automatically!

options = Options()
options.add_argument('--headless=new')
print('Selenium 4.6+ requires no webdriver-manager package — drivers are handled natively.')

Note de reproductibilité

La reproductibilité de cette erreur dépend de l'environnement virtuel Python utilisé et de la présence du paquet webdriver-manager dans les dépendances locales.

Comparison: webdriver-manager vs Selenium Manager

Starting in Selenium 4.6.0, the Selenium core team built an official Rust-based tool called Selenium Manager directly into the selenium package. It automatically inspects Chrome, Edge, and Firefox versions on your machine and downloads the matching driver binaries transparently. If you are using Selenium 4.6+, you can completely remove webdriver-manager from your dependencies.

Contrasting with related errors:

  • ModuleNotFoundError: No module named 'webdriver_manager': The Python wrapper package is missing from site-packages.
  • WebDriverException: 'chromedriver' executable needs to be in PATH: The Selenium package is installed, but no driver binary could be located.