{"id":"7d1114fff6610257","repo":"pypa/pip","slug":"editable-req-is-not-a-valid-editable-requirement","errorCode":null,"errorMessage":"{editable_req} is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with {backends}).","messagePattern":"(.+?) is not a valid editable requirement\\. It should either be a path to a local project or a VCS URL \\(beginning with (.+?)\\)\\.","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/req/constructors.py","lineNumber":159,"sourceCode":"    \"\"\"Parses an editable requirement into:\n        - a requirement name with environment markers\n        - an URL\n        - extras\n    Accepted requirements:\n        - svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir\n        - local_path[some_extra]\n        - Foobar[extra] @ svn+http://blahblah@rev#subdirectory=subdir ; markers\n    \"\"\"\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","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/req/constructors.py#L141-L177","documentation":"Raised by parse_editable() when an `-e`/editable requirement string is neither a local file:// path nor a recognized VCS URL. Editable installs require the source to be a locally checked-out project or a VCS checkout URL (git+, hg+, svn+, bzr+); a plain http(s) URL or bare PyPI name is rejected at constructors.py:157.","triggerScenarios":"Running `pip install -e https://example.com/foo` (plain https, not VCS), `pip install -e requests` (a package name, not a path), or `pip install -e ./missing_dir` where the path does not resolve to a file:// URL. The check is `not link.is_vcs and not link.url.startswith('file:')`.","commonSituations":"Confusing a regular install with an editable one. Forgetting the `git+` prefix on a GitHub URL. Typing a package name instead of a local path. Pointing -e at a URL that 404s into a non-file scheme.","solutions":["If installing a local project in development mode, pass the directory path: `pip install -e ./local_project`.","If installing from a VCS, prefix the URL with the VCS scheme, e.g. `pip install -e git+https://github.com/org/repo.git`.","If you just want the released package, drop the `-e` flag: `pip install requests`.","Double-check the path exists and contains pyproject.toml/setup.py before using -e."],"exampleFix":"# before\npip install -e https://github.com/org/repo.git\n# after\npip install -e git+https://github.com/org/repo.git","handlingStrategy":"validation","validationCode":"import os, re\nfrom pip._internal.vcs import vcs\n\ndef looks_like_valid_editable(spec: str) -> bool:\n    if os.path.isdir(spec):\n        return True\n    schemes = tuple(vcs.all_schemes)  # e.g. git+, hg+, svn+, bzr+\n    return spec.startswith(schemes) or spec.startswith(\"file:\")\n\n# before pip install -e:\nif not looks_like_valid_editable(spec):\n    raise ValueError(f\"{spec!r} must be a local path or VCS URL\")","typeGuard":"def is_editable_spec(spec: str) -> bool:\n    import os\n    from pip._internal.vcs import vcs\n    return (os.path.isdir(spec)\n            or spec.startswith((*vcs.all_schemes, 'file:')))","tryCatchPattern":"from pip._internal.exceptions import InstallationError\n\ntry:\n    ireq = install_req_from_editable(spec)\nexcept InstallationError as e:\n    if \"is not a valid editable requirement\" in str(e):\n        # fall back to a non-editable install or prompt user\n        ...\n    raise","preventionTips":["Reserve -e for local checkouts or explicit VCS URLs (git+, hg+, svn+, bzr+).","For released packages, omit -e.","When in doubt, use `name @ git+url` PEP 508 syntax for clarity."],"tags":["editable","vcs","requirements","packaging"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}