{"id":"a66ceaa9cd648dad","repo":"pypa/pip","slug":"some-build-dependencies-for-requirement-conflict","errorCode":null,"errorMessage":"Some build dependencies for {requirement} conflict with {conflicting_with}: {description}.","messagePattern":"Some build dependencies for (.+?) conflict with (.+?): (.+?)\\.","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/distributions/sdist.py","lineNumber":180,"sourceCode":"                missing, \"normal\", kind=\"backend dependencies\", for_req=self.req\n            )\n\n    def _raise_conflicts(\n        self, conflicting_with: str, conflicting_reqs: set[tuple[str, str]]\n    ) -> None:\n        format_string = (\n            \"Some build dependencies for {requirement} \"\n            \"conflict with {conflicting_with}: {description}.\"\n        )\n        error_message = format_string.format(\n            requirement=self.req,\n            conflicting_with=conflicting_with,\n            description=\", \".join(\n                f\"{installed} is incompatible with {wanted}\"\n                for installed, wanted in sorted(conflicting_reqs)\n            ),\n        )\n        raise InstallationError(error_message)\n\n    def _raise_missing_reqs(self, missing: set[str]) -> None:\n        format_string = (\n            \"Some build dependencies for {requirement} are missing: {missing}.\"\n        )\n        error_message = format_string.format(\n            requirement=self.req, missing=\", \".join(map(repr, sorted(missing)))\n        )\n        raise InstallationError(error_message)\n","sourceCodeStart":162,"sourceCodeEnd":190,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/distributions/sdist.py#L162-L190","documentation":"InstallationError raised by SourceDistribution._raise_conflicts when the build backend's required dependencies (declared in [build-system] requires of pyproject.toml, or dynamically requested by the backend) are present in the build environment but at versions incompatible with what is required. It names the requirement being built, what the deps conflict with, and lists each installed-vs-wanted pair.","triggerScenarios":"Triggered during prepare_distribution_metadata after build_env.check_requirements() returns a non-empty conflicting set - either from the static pyproject [build-system].requires, the PEP 517/518 requirements-to-check, or the dynamic backend dependencies returned by get_requires_for_build_wheel/editable. A dependency already pinned/installed in the environment satisfies a different version specifier than the one the build needs.","commonSituations":"Installing without build isolation (--no-build-isolation) so the ambient environment's packages clash with pyproject build requirements; a lockfile or constraints file pinning a build tool (setuptools/wheel/cython) to a version older/newer than the package's [build-system].requires demands; conflicting transitive build deps across two packages in one install.","solutions":["Drop --no-build-isolation so pip builds in a clean venv that resolves the declared [build-system].requires independently.","Align the offending dependency: install/upgrade the 'installed' package to a version satisfying the 'wanted' specifier, or relax the specifier in pyproject.toml's [build-system].requires.","Remove conflicting pins from any -c constraints file you passed.","Check the listed pair (installed vs wanted) and reconcile that single requirement first."],"exampleFix":"# before - ambient env has setuptools 60 but pyproject needs >=64\n# pyproject.toml\n[build-system]\nrequires = [\"setuptools>=64\", \"wheel\"]\n\n# fix: stop forcing the old version\npip install -U \"setuptools>=64\"\n# or let pip isolate the build\npip install .   # (omit --no-build-isolation)","handlingStrategy":"validation","validationCode":"from pip._internal.utils.compatibility_tags import get_supported\n# before --no-build-isolation, verify build deps are satisfiable\nimport tomllib\nwith open('pyproject.toml','rb') as f: data=tomllib.load(f)\nrequires = data.get('build-system',{}).get('requires',[])\nprint('build-system requires:', requires)\n# pip install each before building with --no-build-isolation","typeGuard":"def build_deps_compatible(installed: dict, requires: list[str]) -> bool:\n    from packaging.requirements import Requirement\n    from packaging.version import Version\n    for r in requires:\n        req = Requirement(r)\n        v = installed.get(req.name)\n        if v is None or not req.specifier.contains(Version(v), prereleases=True):\n            return False\n    return True","tryCatchPattern":"from pip._internal.exceptions import InstallationError\ntry:\n    dist.prepare_distribution_metadata(env_installer, isolation, True, True)\nexcept InstallationError as e:\n    if 'conflict with' in str(e):\n        # parse installed/wanted pairs, reconcile versions\n        ...","preventionTips":["Avoid --no-build-isolation unless the build env is known-good.","Keep pyproject.toml [build-system].requires minimal and correct.","Do not pin build tools in constraints files used for installs.","Reproduce build deps in CI base images."],"tags":["build","pep517","build-isolation","dependencies","conflict"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}