{"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":"exception","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/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/req/constructors.py#L149-L185","documentation":"Raised by parse_editable() when an editable requirement is a VCS URL but pip cannot infer a project name from it (no #egg= fragment and no name@url PEP 508 form). For non-file URLs pip needs an explicit name to track the install; without one it aborts at constructors.py:167 suggesting the `name @ URL` syntax.","triggerScenarios":"Running `pip install -e git+https://github.com/org/repo.git` with no `#egg=reponame` fragment and no `name @` prefix. The package_name returned from _parse_pip_syntax_editable (egg_fragment) and _parse_direct_url_editable (req.name) is None and the URL is not a file: URL.","commonSituations":"Older pip tutorials that omitted the egg fragment worked historically but stricter pip versions require a name. Renaming a repo so the inferred name no longer matches. Using a VCS URL shorthand that lacks metadata.","solutions":["Add an explicit name using PEP 508 direct URL syntax: `pip install -e \"myproject @ git+https://github.com/org/repo.git\"`.","Alternatively append an egg fragment: `pip install -e git+https://github.com/org/repo.git#egg=myproject`.","Ensure the name you supply matches the distribution name to avoid later conflicts."],"exampleFix":"# before\npip install -e git+https://github.com/org/repo.git\n# after\npip install -e \"myproject @ git+https://github.com/org/repo.git\"","handlingStrategy":"validation","validationCode":"import re\n\ndef ensure_editable_has_name(spec: str) -> str:\n    # ensure either 'name @ url' or '#egg=name' is present for VCS urls\n    if spec.startswith((\"git+\", \"hg+\", \"svn+\", \"bzr+\")):\n        if \"@\" not in spec.split(\"://\", 1)[-1].split(\"#\", 1)[0] and \"#egg=\" not in spec:\n            raise ValueError(f\"Editable VCS spec {spec!r} needs a name: use 'name @ url' or '#egg=name'\")\n    return spec","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Always use PEP 508 direct URL form `name @ git+https://...` for editable VCS installs.","Or append `#egg=<dist-name>` to VCS URLs.","Match the supplied name to the project's actual distribution name."],"tags":["editable","vcs","requirements","pep508"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}