{"id":"91e228af85733313","repo":"pypa/pip","slug":"directory-entries-are-not-supported-in-remote-pylo","errorCode":null,"errorMessage":"Directory entries are not supported in remote pylock.toml {pylock_path_or_url!r}","messagePattern":"Directory entries are not supported in remote pylock\\.toml (.+?)","errorType":"exception","errorClass":"InstallationError","httpStatus":null,"severity":"error","filePath":"src/pip/_internal/utils/pylock.py","lineNumber":224,"sourceCode":") -> str:\n    url = _package_dist_url(\n        pylock_path_or_url, package_archive.path, package_archive.url\n    )\n    if package_archive.subdirectory:\n        if \"#\" in url:\n            raise InstallationError(\n                f\"Package URL {url!r} cannot contain fragments in combination \"\n                f\"with subdirectory field (in {pylock_path_or_url!r})\"\n            )\n        url += \"#subdirectory=\" + package_archive.subdirectory\n    return url\n\n\ndef package_directory_requirement_url(\n    pylock_path_or_url: str, package_directory: PackageDirectory\n) -> str:\n    if _is_url(pylock_path_or_url) and not pylock_path_or_url.startswith(\"file://\"):\n        raise InstallationError(\n            f\"Directory entries are not supported in remote pylock.toml \"\n            f\"{pylock_path_or_url!r}\"\n        )\n    url = _package_dist_url(pylock_path_or_url, package_directory.path, None)\n    assert url.startswith(\"file://\")\n    if not url.endswith(\"/\"):\n        url += \"/\"\n    if package_directory.subdirectory:\n        url += package_directory.subdirectory\n        if not url.endswith(\"/\"):\n            url += \"/\"\n    return url\n\n\ndef package_sdist_requirement_url(\n    pylock_path_or_url: str, package_sdist: PackageSdist\n) -> str:\n    return _package_dist_url(pylock_path_or_url, package_sdist.path, package_sdist.url)","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/pypa/pip/blob/d7d0d0a39494e28ec1c407bd0680e4a4d1067791/src/pip/_internal/utils/pylock.py#L206-L242","documentation":"InstallationError from package_directory_requirement_url when a pylock.toml fetched from a remote (non-file://) URL contains a directory package entry. A remote lock cannot point the installer at a local source directory the lock author happened to have; pip refuses because directory installs require a real local path.","triggerScenarios":"_is_url(pylock_path_or_url) is True and the scheme does not start with 'file://', and a package entry is of the directory type (PackageDirectory). E.g. `pip install -r https://example.com/lock.toml` where the lock lists `[[packages.directory]]`.","commonSituations":"A development lock (containing local editable/directory installs) accidentally published/served over HTTP; a lock generated for an in-repo monorepo consumed by an external CI via URL.","solutions":["Remove directory entries from remotely-served locks; replace them with built artifacts referenced by url (wheel/sdist) or VCS url.","Serve the lock file from a local path (or file:// URL) if directory entries are genuinely needed.","Split the lock: a remote lock for binary deps + a local lock for in-tree directory deps."],"exampleFix":"# before - remote lock.toml with a directory entry\n# served at https://example.com/lock.toml\n[[packages.directory]]\npath = \"./libs/mypkg\"\n\n# after - reference a built artifact instead\n[[packages.wheel]]\nurl = \"https://example.com/wheels/mypkg-1.0-py3-none-any.whl\"","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\ndef remote_lock_has_no_directory_entries(lock_url, packages):\n    if urlparse(lock_url).scheme in ('http', 'https'):\n        return not any(p.get('type') == 'directory' for p in packages)\n    return True\n# check before serving a lock over HTTP(S)","typeGuard":null,"tryCatchPattern":"try:\n    pip_install('-r', lock_url)\nexcept InstallationError as e:\n    if 'Directory entries are not supported in remote pylock' in str(e):\n        replace_directory_entries_with_wheels(lock_url)\n        pip_install('-r', lock_url)\n    else:\n        raise","preventionTips":["Don't publish development locks (with directory entries) over HTTP.","Reference built wheels/sdists or VCS urls for remotely-consumed locks.","Keep a separate local lock for in-tree directory installs."],"tags":["pip","pylock","directory","url","lockfile","remote"],"analyzedSha":"d7d0d0a39494e28ec1c407bd0680e4a4d1067791","analyzedAt":"2026-08-04T20:55:04.259Z","schemaVersion":2}