pypa/pip · error · InstallationError
Could not detect requirement name for '{editable_req}', plea
Error message
Could not detect requirement name for '{editable_req}', please specify one with your_package_name @ URL What it means
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.
Source
Thrown at src/pip/_internal/req/constructors.py:167
"""
try:
package_name, url, extras = _parse_direct_url_editable(editable_req)
except ValueError:
package_name, url, extras = _parse_pip_syntax_editable(editable_req)
link = Link(url)
if not link.is_vcs and not link.url.startswith("file:"):
backends = ", ".join(vcs.all_schemes)
raise InstallationError(
f"{editable_req} is not a valid editable requirement. "
f"It should either be a path to a local project or a VCS URL "
f"(beginning with {backends})."
)
# The project name can be inferred from local file URIs easily.
if not package_name and not link.url.startswith("file:"):
raise InstallationError(
f"Could not detect requirement name for '{editable_req}', "
"please specify one with your_package_name @ URL"
)
return package_name, url, extras
def check_first_requirement_in_file(filename: str) -> None:
"""Check if file is parsable as a requirements file.
This is heavily based on ``pkg_resources.parse_requirements``, but
simplified to just check the first meaningful line.
:raises InvalidRequirement: If the first meaningful line cannot be parsed
as an requirement.
"""
with open(filename, encoding="utf-8", errors="ignore") as f:
# Create a steppable iterator, so we can handle \-continuations.
lines = (View on GitHub (pinned to d7d0d0a394)
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.
Example fix
# before pip install -e git+https://github.com/org/repo.git # after pip install -e "myproject @ git+https://github.com/org/repo.git"
Defensive patterns
Strategy: validation
Validate before calling
import re
def ensure_editable_has_name(spec: str) -> str:
# ensure either 'name @ url' or '#egg=name' is present for VCS urls
if spec.startswith(("git+", "hg+", "svn+", "bzr+")):
if "@" not in spec.split("://", 1)[-1].split("#", 1)[0] and "#egg=" not in spec:
raise ValueError(f"Editable VCS spec {spec!r} needs a name: use 'name @ url' or '#egg=name'")
return spec Type guard
null
Try / catch
null
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- {editable_req} is not a valid editable requirement. It shoul
- Invalid requirement: {name!r}: {exc}
- Editable requirements are not allowed as constraints
- Invalid requirement: {name.strip()!r}: {exc}
- Invalid requirement: {req_as_string!r}: {exc}
AI-assisted analysis of pypa/pip@d7d0d0a394 (2026-08-04).
Data as JSON: /data/errors/8c05bbbbbec00b0e.json.
Report an issue: GitHub.