{"id":"49d627b8db68e647","repo":"python-poetry/poetry","slug":"package-name-not-found-49d627","errorCode":null,"errorMessage":"Package [{name}] not found.","messagePattern":"Package \\[(.+?)\\] not found\\.","errorType":"exception","errorClass":"PackageNotFoundError","httpStatus":null,"severity":"error","filePath":"src/poetry/repositories/pypi_repository.py","lineNumber":113,"sourceCode":"    def get_package_info(self, name: NormalizedName) -> dict[str, Any]:\n        \"\"\"\n        Return the package information given its name.\n\n        The information is returned from the cache if it exists\n        or retrieved from the remote server.\n        \"\"\"\n        return self._get_package_info(name)\n\n    def _package(\n        self, name: NormalizedName, version: Version, yanked: str | bool\n    ) -> Package:\n        return Package(name, version, yanked=yanked)\n\n    def _get_package_info(self, name: NormalizedName) -> dict[str, Any]:\n        headers = {\"Accept\": \"application/vnd.pypi.simple.v1+json\"}\n        info = self._get(f\"simple/{name}/\", headers=headers)\n        if info is None:\n            raise PackageNotFoundError(f\"Package [{name}] not found.\")\n\n        return info\n\n    def find_links_for_package(self, package: Package) -> list[Link]:\n        json_data = self._get(f\"pypi/{package.name}/{package.version}/json\")\n        if json_data is None:\n            return []\n\n        links = []\n        for url in json_data[\"urls\"]:\n            if url[\"packagetype\"] in SUPPORTED_PACKAGE_TYPES:\n                h = f\"sha256={url['digests']['sha256']}\"\n                links.append(Link(url[\"url\"] + \"#\" + h, yanked=self._get_yanked(url)))\n\n        return links\n\n    def _get_release_info(\n        self, name: NormalizedName, version: Version","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/repositories/pypi_repository.py#L95-L131","documentation":"Raised by PyPIRepository._get_package_info when the PyPI JSON simple endpoint for a package returns None (pypi_repository.py:109-113), i.e. the package name has no page on the public PyPI. This is the package-level (not version-level) not-found for the default PyPI source.","triggerScenarios":"get_package_info(name) / package lookup on the default PyPI repository for a name that does not exist on pypi.org (HTTP 404 from the simple endpoint, collapsed to None).","commonSituations":"Typo in the dependency name; package was removed/renamed on PyPI; package is private and only exists on a different index; name not yet published at first release.","solutions":["Search pypi.org for the exact project name and correct the spelling in pyproject.toml.","If the package lives on a private index, configure that source and reference it by name.","Check whether the project was renamed and use the new name."],"exampleFix":"// before\n[tool.poetry.dependencies]\nreqests = \"^2.31\"   # typo\n// after\n[tool.poetry.dependencies]\nrequests = \"^2.31\"","handlingStrategy":"validation","validationCode":"from packaging.utils import canonicalize_name\nimport requests\nr = requests.get(f\"https://pypi.org/simple/{canonicalize_name(name)}/\", timeout=10)\nif r.status_code == 404:\n    raise LookupError(f\"{name} does not exist on PyPI; check spelling\")","typeGuard":null,"tryCatchPattern":"from poetry.repositories.exceptions import PackageNotFoundError\ntry:\n    info = pypi_repo.get_package_info(canonicalize_name(name))\nexcept PackageNotFoundError:\n    log.error(\"%s not found on PyPI; verify the name\", name)\n    raise","preventionTips":["Copy dependency names directly from pypi.org to avoid typos.","Search PyPI before adding an unfamiliar package.","If a package is private, point the dependency at the private source by name."],"tags":["pypi","package-not-found","typo"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}