{"id":"716db41f9b7f25d4","repo":"python-poetry/poetry","slug":"failed-to-install-requirements","errorCode":null,"errorMessage":"Failed to install {requirements}.","messagePattern":"Failed to install (.+?)\\.","errorType":"exception","errorClass":"IsolatedBuildInstallError","httpStatus":null,"severity":"error","filePath":"src/poetry/utils/isolated_build.py","lineNumber":170,"sourceCode":"                if constraint.marker.validate(env_markers):\n                    constraints_group.add_dependency(constraint)\n            package.add_dependency_group(constraints_group)\n\n        io = BufferedIO()\n\n        installer = Installer(\n            io,\n            self._env,\n            package,\n            Locker(self._env.path.joinpath(\"poetry.lock\"), {}),\n            self._pool,\n            Config.create(),\n            InstalledRepository.load(self._env),\n        )\n        installer.update(True)\n\n        if installer.run() != 0:\n            raise IsolatedBuildInstallError(\n                requirements, io.fetch_output(), io.fetch_error()\n            )\n\n\n@contextmanager\ndef isolated_builder(\n    source: Path,\n    distribution: DistributionType = \"wheel\",\n    python_executable: Path | None = None,\n    pool: RepositoryPool | None = None,\n    *,\n    build_constraints: list[Dependency] | None = None,\n) -> Iterator[ProjectBuilder]:\n    from build import ProjectBuilder\n    from pyproject_hooks import quiet_subprocess_runner\n\n    from poetry.factory import Factory\n","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/utils/isolated_build.py#L152-L188","documentation":"IsolatedEnv.install (isolated_build.py) builds a Package from the PEP 508 build-system requirements, runs Poetry's Installer in the ephemeral build venv, and raises IsolatedBuildInstallError(requirements, stdout, stderr) whenever installer.run() returns non-zero. In other words: installing the build backend's own dependencies (setuptools, flit-core, hatchling, poetry-core, etc.) into the isolated environment failed. The exception carries the captured installer stdout/stderr for diagnosis.","triggerScenarios":"During `poetry build` or any dependency resolution that triggers an isolated/PEP 517 build, when [build-system].requires in a project's pyproject.toml cannot be installed in the ephemeral venv: network error, package name typo, version not present on configured sources, or conflicting constraints.","commonSituations":"Offline or proxy-blocked environments; private package index misconfigured or unreachable; build-system.requires pinning a version that doesn't exist; transient PyPI outage; corrupted Poetry cache.","solutions":["Read the exception's captured stdout/stderr (it is passed into IsolatedBuildInstallError) to see the underlying installer/pip failure reason.","Verify sources and connectivity: `poetry source show`, and test reachability of the configured indexes.","Correct [build-system].requires in pyproject.toml (names, versions, markers).","Clear Poetry's cache (`poetry cache clear --all pypi`) and retry to rule out a stale/corrupted artifact."],"exampleFix":"# before - build-system.requires with a typo / unreachable version\n[build-system]\nrequires = [\"poetry-cory>=1.0\"]\n# after\n[build-system]\nrequires = [\"poetry-core>=1.0.0\"]\nbuild-backend = \"poetry.core.masonry.api\"","handlingStrategy":"try-catch","validationCode":"import tomllib\nfrom pathlib import Path\n\ndef build_requires_look_ok(pyproject: Path) -> bool:\n    data = tomllib.loads(pyproject.read_text())\n    reqs = data.get('tool', {}).get('poetry', {}) \\\n        if False else data.get('build-system', {}).get('requires', [])\n    return bool(reqs) and all(isinstance(r, str) and r.strip() for r in reqs)","typeGuard":null,"tryCatchPattern":"from poetry.utils.isolated_build import IsolatedBuildInstallError\ntry:\n    with isolated_builder(source) as builder:\n        ...\nexcept IsolatedBuildInstallError as e:\n    # e.requirements, and the captured stdout/stderr explain the failure\n    print('build deps failed:', e.requirements)\n    raise","preventionTips":["Keep [build-system].requires minimal and pinned to real package names.","Ensure all configured sources are reachable before building.","Run builds online first to populate caches before going offline."],"tags":["build","pep517","isolated-build","dependencies","installer"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}