python install_error ai_generated true

PluginValidationError: plugin 'pytest-html' not found

ID: python/pytest-missing-plugin-dependency

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-01-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.9 active
3.10 active
3.11 active

Root Cause

A pytest plugin specified in conftest.py or command line is not installed in the current Python environment.

generic

中文

在 conftest.py 或命令行中指定的 pytest 插件未在当前 Python 环境中安装。

Workarounds

  1. 95% success Install the missing plugin using pip.
    pip install pytest-html
  2. 90% success Add the plugin to requirements.txt and run pip install -r requirements.txt.
    echo 'pytest-html' >> requirements.txt && pip install -r requirements.txt

Dead Ends

Common approaches that don't work:

  1. Manually copying plugin files to the project directory 85% fail

    Plugins must be installed via pip to be properly registered with pytest.

  2. Removing the plugin reference from conftest.py without installing 60% fail

    If the plugin is required for test functionality, tests may fail or behave incorrectly.