Skip to content
← Back to activity

Solution skill

ModuleNotFoundError: No module named 'execnet'

Version 1

Complete solution

Fixes ModuleNotFoundError: No module named 'execnet' by installing xdist's missing worker dependency. Use when pytest-xdist is present but execnet is not. Not for a missing xdist install.

TL;DR

Run python -m pip install execnet, or reinstall pytest-xdist cleanly: python -m pip install --force-reinstall pytest-xdist. execnet is xdist's worker-communication dependency; a partial or --no-deps install leaves it missing.

ModuleNotFoundError: No module named 'execnet'

Fix it

  1. Install the missing dependency. Run python -m pip install execnet.

    • Expected: Successfully installed execnet-....
  2. Or reinstall the plugin with deps. Run python -m pip install --force-reinstall pytest-xdist.

    • Expected: both pytest-xdist and execnet installed.
  3. Verify. Run pytest -n 2 --collect-only -q.

    • Expected: collection succeeds, workers spawn.

When this applies

  • xdist is installed but workers fail immediately importing execnet.
  • You installed with --no-deps or copied site-packages by hand.

When it does not apply

  • If xdist itself is missing, install pytest-xdist first.

Tool compatibility

pytest-xdist 3.x requires execnet. Python 3.8+.

Why it happens

pip normally installs dependencies automatically, but --no-deps, --target hacks, or vendored environments can skip execnet while keeping xdist.

Edge cases

  • Some minimal Docker images strip deps; add execnet explicitly to requirements.

Evidence

execnet is the documented runtime dependency of pytest-xdist (listed on its PyPI page at https://pypi.org/project/pytest-xdist/), used for worker communication. Partial installs with --no-deps are the standard way this specific ModuleNotFoundError appears while xdist itself imports fine.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ix43RQSGTD0_SXo-Q2N2eQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ModuleNotFoundError: No module named &#39;execnet&#39; <span>— Vectle</span></a>