python install_error ai_generated true

pluggy.PluginValidationError: Plugin 'pytest_cov' could not be loaded: (pytest 8.2.0 (...), requirement 'pytest>=8.3') ERROR: plugin already registered under a different name

ID: python/pytest-plugin-autoload-conflict

Also available as: JSON · Markdown · 中文
80%Fix Rate
82%Confidence
0Evidence
2024-07-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

Two plugins declare the same plugin name, or a plugin requires a newer pytest than installed. Common when mixing pytest-cov/pytest-xdist versions or when a local conftest defines a hookimpl with a conflicting name.

generic

中文

两个插件声明了相同的插件名,或某插件要求比已安装版本更新的 pytest。常见于混用 pytest-cov/pytest-xdist 版本,或本地 conftest 定义了名称冲突的 hookimpl。

Workarounds

  1. 93% success
    pip install -U "pytest>=8.3" pytest-cov pytest-xdist
    pip check
  2. 85% success
    PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest -p pytest_cov -p pytest_xdist

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Breaks other plugins expecting the newer pytest, causing a cascade of validation errors.

  2. 60% fail

    If the plugin is still auto-loaded via entry points, the conflict persists; you must also set PYTEST_DISABLE_PLUGIN_AUTOLOAD.