{"id":"c58bbe07b024dbc7","repo":"pypa/pip","slug":"the-editable-requirement-req-cannot-be-installed","errorCode":null,"errorMessage":"The editable requirement {req} cannot be installed when requiring hashes, because there is no single file to hash.","messagePattern":"The editable requirement (.+?) cannot be installed when requiring hashes, because there is no single file to hash\\.","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/operations/prepare.py","lineNumber":851,"sourceCode":"\n        download_location = join_within_directory(self.download_dir, link.filename)\n        if not os.path.exists(download_location):\n            shutil.copy(req.local_file_path, download_location)\n            download_path = display_path(download_location)\n            logger.info(\"Saved %s\", download_path)\n\n    def prepare_editable_requirement(\n        self,\n        req: InstallRequirement,\n    ) -> BaseDistribution:\n        \"\"\"Prepare an editable requirement.\"\"\"\n        assert req.editable, \"cannot prepare a non-editable req as editable\"\n\n        logger.info(\"Obtaining %s\", req)\n\n        with indent_log():\n            if self.require_hashes:\n                raise InstallationError(\n                    f\"The editable requirement {req} cannot be installed when \"\n                    \"requiring hashes, because there is no single file to \"\n                    \"hash.\"\n                )\n            req.ensure_has_source_dir(self.src_dir)\n            req.update_editable()\n            assert req.source_dir\n            req.download_info = direct_url_for_editable(req.unpacked_source_directory)\n\n            dist = _get_prepared_distribution(\n                req,\n                self.build_tracker,\n                self.build_env_installer,\n                self.build_isolation,\n                self.check_build_deps,\n                self.allow_editables,\n            )\n","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/operations/prepare.py#L833-L869","documentation":"Raised as InstallationError when an editable requirement (-e) is processed while --require-hashes is active. At prepare.py:850-855, prepare_editable_requirement checks self.require_hashes first and aborts because an editable install has no single file to hash — the source directory is mutable and produces no checksummable artifact.","triggerScenarios":"Running 'pip install --require-hashes -e .' or including '-e ./local-pkg' in a hashed requirements file. pip refuses to combine editable installs with mandatory hash verification.","commonSituations":"Monorepo or local-development workflow where some packages are editable, combined with a CI policy enforcing --require-hashes for reproducibility/security.","solutions":["Convert the editable install to a built wheel and pin it by hash: pip wheel . --no-deps -w ./wheels, then reference ./wheels/<pkg>.whl with --hash.","Split the environment: install hashed dependencies into the base env, and install the editable package into a separate dev env without --require-hashes.","Remove -e and install the package as a normal (non-editable) requirement pinned with a hash.","Relax --require-hashes for the editable build if strict hashing is not mandatory."],"exampleFix":"# before\npip install --require-hashes -e .\n\n# after: build a wheel and pin by hash\npip wheel . --no-deps -w ./wheels\npip install --require-hashes \\\n  ./wheels/mypkg-1.0-py3-none-any.whl \\\n  --hash=sha256:0123...cdef","handlingStrategy":"validation","validationCode":"def assert_no_editable_under_require_hashes(requirements_lines, require_hashes):\n    if not require_hashes:\n        return\n    bad = [l for l in requirements_lines if l.strip().startswith(\"-e\") or \" #egg=\" in l and l.startswith(\"-\")]\n    if bad:\n        raise SystemExit(f\"editable requirements incompatible with --require-hashes: {bad}\")","typeGuard":"def is_editable_req(line: str) -> bool:\n    s = line.strip()\n    return s.startswith(\"-e \") or s.startswith(\"--editable\")","tryCatchPattern":null,"preventionTips":["Never combine -e with --require-hashes; build a wheel and pin by hash instead.","Split dev (editable) and prod (hashed) environments.","Add a lint rule that flags editable lines in hashed requirements files."],"tags":["hashes","require-hashes","editable","install","security"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}