{"record":{"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":"validation","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/f399c3718970b1b0e2478dac5296eb62679a9b86/src/pip/_internal/req/constructors.py#L141-L177","documentation":"Raised by parse_editable (constructors.py:159) when an editable requirement string parses to a URL that is neither a VCS URL (git+/hg+/svn+/bzr+) nor a file:// path. Editable installs require either a local project path or a VCS checkout URL; anything else is rejected with the list of accepted VCS schemes.","triggerScenarios":"Passing '-e <something>' where <something> resolves to an http(s) URL, an unsupported scheme, or a non-path string that isn't recognized as file: or a VCS scheme. Checked via link.is_vcs and link.url.startswith('file:').","commonSituations":"Typing 'pip install -e https://github.com/x/y' instead of 'pip install -e git+https://...'; using an http:// URL for editable install; a path that doesn't exist and isn't converted to file:.","solutions":["For a local project, give the directory path: 'pip install -e ./path/to/project'.","For a remote repo, use a VCS scheme: 'pip install -e git+https://github.com/x/y.git'.","If you only need a non-editable install from a URL, drop the -e flag and use a direct URL/reference."],"exampleFix":"# before\npip install -e https://github.com/user/repo\n# after\npip install -e git+https://github.com/user/repo.git\n# or local\npip install -e ./myproject","handlingStrategy":"validation","validationCode":"from pip._internal.vcs import vcs\n\ndef is_valid_editable_target(line: str) -> bool:\n    low = line.lower()\n    if low.startswith('file:'):\n        return True\n    import os\n    if os.path.isdir(line):\n        return True\n    return any(low.startswith(s + '+') or low.startswith(s + ':') for s in vcs.all_schemes)\n\nif __name__ == '__main__':\n    import sys\n    if not is_valid_editable_target(sys.argv[1]):\n        print(f'{sys.argv[1]!r} is not a local path or VCS URL'); sys.exit(1)","typeGuard":"from pip._internal.vcs import vcs\nimport os\n\ndef is_editable_compatible(line: str) -> bool:\n    low = line.lower()\n    return (low.startswith('file:')\n            or os.path.isdir(line)\n            or any(low.startswith(s + '+') or low.startswith(s + ':') for s in vcs.all_schemes))","tryCatchPattern":"from subprocess import run, CalledProcessError\ntry:\n    run([\"pip\", \"install\", \"-e\", target], check=True)\nexcept CalledProcessError:\n    # Convert http(s) URL to a VCS URL or use non-editable install.\n    run([\"pip\", \"install\", \"-e\", \"git+\" + target], check=True)","preventionTips":["Use a VCS scheme (git+/hg+/svn+/bzr+) for remote editable installs.","Use a local directory path for local editable installs.","Drop -e for plain remote URLs that are not checkouts."],"tags":["editable","vcs","file-url","validation","pip"],"backgroundTag":null,"analyzedSha":"f399c3718970b1b0e2478dac5296eb62679a9b86","analyzedAt":"2026-08-08T23:01:42.227Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}