{"record":{"id":"8c05bbbbbec00b0e","repo":"pypa/pip","slug":"could-not-detect-requirement-name-for-editable-r","errorCode":null,"errorMessage":"Could not detect requirement name for '{editable_req}', please specify one with your_package_name @ URL","messagePattern":"Could not detect requirement name for '(.+?)', please specify one with your_package_name @ URL","errorType":"validation","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/req/constructors.py","lineNumber":167,"sourceCode":"    \"\"\"\n    try:\n        package_name, url, extras = _parse_direct_url_editable(editable_req)\n    except ValueError:\n        package_name, url, extras = _parse_pip_syntax_editable(editable_req)\n\n    link = Link(url)\n\n    if not link.is_vcs and not link.url.startswith(\"file:\"):\n        backends = \", \".join(vcs.all_schemes)\n        raise InstallationError(\n            f\"{editable_req} is not a valid editable requirement. \"\n            f\"It should either be a path to a local project or a VCS URL \"\n            f\"(beginning with {backends}).\"\n        )\n\n    # The project name can be inferred from local file URIs easily.\n    if not package_name and not link.url.startswith(\"file:\"):\n        raise InstallationError(\n            f\"Could not detect requirement name for '{editable_req}', \"\n            \"please specify one with your_package_name @ URL\"\n        )\n    return package_name, url, extras\n\n\ndef check_first_requirement_in_file(filename: str) -> None:\n    \"\"\"Check if file is parsable as a requirements file.\n\n    This is heavily based on ``pkg_resources.parse_requirements``, but\n    simplified to just check the first meaningful line.\n\n    :raises InvalidRequirement: If the first meaningful line cannot be parsed\n        as an requirement.\n    \"\"\"\n    with open(filename, encoding=\"utf-8\", errors=\"ignore\") as f:\n        # Create a steppable iterator, so we can handle \\-continuations.\n        lines = (","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/pypa/pip/blob/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/req/constructors.py#L149-L185","documentation":"Raised by parse_editable (constructors.py:166) when an editable VCS URL has no detectable project name (no #egg= fragment and no PEP 508 'name @ url' form) and the URL is not a file: path (from which a name can be inferred). pip needs a name for the InstallRequirement, so it asks the user to supply one explicitly.","triggerScenarios":"An editable VCS requirement like '-e git+https://.../repo.git' without a '#egg=RepoName' fragment or a 'RepoName @ git+https://...' form, where package_name stays None and the link is not file:.","commonSituations":"Old-style egg fragments removed during a refactor; copy-pasting a bare git URL after -e; migrating from pip syntax to PEP 508 direct-url syntax.","solutions":["Use PEP 508 direct-URL form: 'pip install -e \"projectname @ git+https://.../repo.git\"'.","Or add the legacy egg fragment: 'pip install -e git+https://.../repo.git#egg=projectname'.","Check the package's setup.cfg/pyproject.toml [project].name and use exactly that name."],"exampleFix":"# before\npip install -e git+https://github.com/user/repo.git\n# after (PEP 508 form)\npip install -e 'myproject @ git+https://github.com/user/repo.git'\n# or legacy egg fragment\npip install -e git+https://github.com/user/repo.git#egg=myproject","handlingStrategy":"validation","validationCode":"from pip._vendor.packaging.requirements import Requirement, InvalidRequirement\nfrom urllib.parse import urlparse\n\ndef editable_has_name(line: str) -> bool:\n    # PEP 508 form: 'name @ url'\n    try:\n        r = Requirement(line)\n        if r.url and r.name:\n            return True\n    except InvalidRequirement:\n        pass\n    # legacy form: '...#egg=Name'\n    if '#egg=' in line:\n        return True\n    return False","typeGuard":"def editable_has_explicit_name(line: str) -> bool:\n    return ('@ ' in line and not line.startswith('@')) or '#egg=' in line","tryCatchPattern":"from subprocess import run, CalledProcessError\ntry:\n    run([\"pip\", \"install\", \"-e\", vcs_url], check=True)\nexcept CalledProcessError:\n    # Retry with explicit name: 'name @ url'.\n    run([\"pip\", \"install\", \"-e\", f\"{name} @ {vcs_url}\"], check=True)","preventionTips":["Always provide the project name for VCS editable installs (PEP 508 'name @ url' preferred).","Use the exact [project].name from the target package.","Prefer PEP 508 direct-URL form over legacy #egg= fragments."],"tags":["editable","vcs","requirement-name","pep508","validation","pip"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}