{"record":{"id":"4d9c74eb03576191","repo":"pypa/pip","slug":"editable-requirements-are-not-allowed-as-constrain-4d9c74","errorCode":null,"errorMessage":"Editable requirements are not allowed as constraints","messagePattern":"Editable requirements are not allowed as constraints","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/resolution/resolvelib/factory.py","lineNumber":553,"sourceCode":"            else:\n                # require the base from the link\n                yield self.make_requirement_from_candidate(cand)\n                if ireq.extras:\n                    # require the extras on top of the base candidate\n                    yield self.make_requirement_from_candidate(\n                        self._make_extras_candidate(cand, frozenset(ireq.extras))\n                    )\n\n    def collect_root_requirements(\n        self, root_ireqs: list[InstallRequirement]\n    ) -> CollectedRootRequirements:\n        collected = CollectedRootRequirements([], {}, {})\n        for i, ireq in enumerate(root_ireqs):\n            if ireq.constraint:\n                # Ensure we only accept valid constraints\n                problem = check_invalid_constraint_type(ireq)\n                if problem:\n                    raise InstallationError(problem)\n                if not ireq.match_markers():\n                    continue\n                assert ireq.name, \"Constraint must be named\"\n                name = canonicalize_name(ireq.name)\n                if name in collected.constraints:\n                    collected.constraints[name] &= ireq\n                else:\n                    collected.constraints[name] = Constraint.from_ireq(ireq)\n            else:\n                reqs = list(\n                    self._make_requirements_from_install_req(\n                        ireq,\n                        requested_extras=(),\n                    )\n                )\n                if not reqs:\n                    continue\n                template = reqs[0]","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/resolution/resolvelib/factory.py#L535-L571","documentation":"check_invalid_constraint_type (req_install.py:813-814) and collect_root_requirements (factory.py:551-553) reject editable (-e) requirements inside a constraints file. Constraints only constrain versions; editable installs are a deployment form, not a version pin, so the new resolver forbids them in -c files.","triggerScenarios":"A constraints file referenced via -c contains an editable requirement line such as `-e ./local/pkg` or `-e git+https://...`.","commonSituations":"Trying to pin a locally-developed editable package as a constraint; porting old-style constraints that mixed -e lines.","solutions":["Move editable installs to the main requirements file, not the constraints file.","In the constraints file use a plain version specifier (pkg==X) for the same package."],"exampleFix":"# before (constraints.txt)\n-e ./local/pkg\n# after\n# in constraints.txt:\npkg==1.0\n# in requirements.txt:\n-e ./local/pkg","handlingStrategy":"validation","validationCode":"# Validate a constraints file has no editable (-e) lines.\nfor line in open(\"constraints.txt\"):\n    s = line.strip()\n    if s.startswith(\"-e\") or s.startswith(\"--editable\"):\n        print(f\"Editable requirement not allowed in constraints: {s}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Put editable (-e) installs only in the main requirements file.","Use plain version specifiers in constraints files.","Lint constraints files for -e flags in CI."],"tags":["constraints","editable"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}