Python

Verified against ChatGPT · 2026-07-11

Diagnose a Python dependency or virtual environment conflict systematically

A structured diagnostic prompt for dependency and venv breakage that requires a stated root-cause hypothesis and cited evidence before proposing a fix, instead of jumping straight to pip install --upgrade.

ChatGPT (GPT-5.1)Claude (Sonnet 4.6)Claude CodePerplexity

The prompt

Ready to copy — highlighted parts are example details you can swap.

Diagnose this Python environment or dependency problem. Do not propose a fix until you've stated a specific hypothesis for the root cause — "try reinstalling" is not a diagnosis.

ERROR
ImportError: cannot import name "BaseSettings" from "pydantic" — happens after upgrading a different package.

ENVIRONMENT
Windows 11, Python 3.12, venv created with python -m venv .venv

PACKAGE MANAGER IN USE
uv

DIAGNOSTIC PROCESS
1. Identify the failure category first: a version conflict between two packages' requirements, a missing system-level dependency (compiler, system library), a wrong or stale virtual environment being activated, a Python version mismatch (a package with no wheel for this Python version), or a corrupted/partial install. State which one this looks like and why, citing the specific line in the error output.
2. Ask for exactly the information you're missing to confirm the hypothesis, if anything — pip list output, the package manager's version, which python, or the lockfile — rather than guessing further.
3. Once confirmed, give the fix as ordered, copy-pasteable commands, not a paragraph description. Note which command is destructive (e.g. deleting a virtual environment) before it runs.
4. Give one prevention step specific to this failure category — pinning a version range, adding a lockfile, using a resolver like uv or pip-tools for reproducible installs — not a generic "keep dependencies updated."

CONSTRAINTS
- Don't suggest pip install --upgrade or --force-reinstall as a first move; that can mask the real problem and break other packages pinned lower in the dependency tree.
- If the fix could change behavior elsewhere in the project (a major version bump), say so and ask before assuming it's fine.

OUTPUT FORMAT
Root cause hypothesis, then confirming evidence needed if any, then exact fix commands, then one line on preventing this category next time.
Customize the highlighted detailsoptional — the prompt above already works

Why this works

Forcing a stated hypothesis, with a cited line from the error output, before any fix is proposed directly prevents the most common LLM failure mode on dependency errors: pattern-matching the error text to a generic "reinstall your packages" answer that either doesn't address the real conflict or actively masks it by upgrading something that was correctly pinned. Naming the real failure categories — a missing wheel for the installed Python version, a stale virtual environment still pointing at an old interpreter, a native compiler dependency the OS doesn't have — gives the model concrete diagnostic branches to reason through instead of one catch-all response. The explicit ban on leading with --force-reinstall reflects real practitioner knowledge: in a project with pinned versions, a force-reinstall of one package can silently pull in incompatible versions of its own dependencies, turning one broken import into three.

Verified against

ChatGPT GPT-5.1 · 2026-07-11

Changelog

  • 2026-07-11 Initial publish, verified against ChatGPT (GPT-5.1) on a uv-managed Python 3.12 project.

Need this built into your business?

If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
All Python prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY