python-poetry/poetry · error · PackageNotFoundError
Package [{name}] not found.
Error message
Package [{name}] not found. What it means
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.
Source
Thrown at src/poetry/repositories/pypi_repository.py:113
def get_package_info(self, name: NormalizedName) -> dict[str, Any]:
"""
Return the package information given its name.
The information is returned from the cache if it exists
or retrieved from the remote server.
"""
return self._get_package_info(name)
def _package(
self, name: NormalizedName, version: Version, yanked: str | bool
) -> Package:
return Package(name, version, yanked=yanked)
def _get_package_info(self, name: NormalizedName) -> dict[str, Any]:
headers = {"Accept": "application/vnd.pypi.simple.v1+json"}
info = self._get(f"simple/{name}/", headers=headers)
if info is None:
raise PackageNotFoundError(f"Package [{name}] not found.")
return info
def find_links_for_package(self, package: Package) -> list[Link]:
json_data = self._get(f"pypi/{package.name}/{package.version}/json")
if json_data is None:
return []
links = []
for url in json_data["urls"]:
if url["packagetype"] in SUPPORTED_PACKAGE_TYPES:
h = f"sha256={url['digests']['sha256']}"
links.append(Link(url["url"] + "#" + h, yanked=self._get_yanked(url)))
return links
def _get_release_info(
self, name: NormalizedName, version: VersionView on GitHub (pinned to 92b74dcfe3)
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.
Example fix
// before [tool.poetry.dependencies] reqests = "^2.31" # typo // after [tool.poetry.dependencies] requests = "^2.31"
Defensive patterns
Strategy: validation
Validate before calling
from packaging.utils import canonicalize_name
import requests
r = requests.get(f"https://pypi.org/simple/{canonicalize_name(name)}/", timeout=10)
if r.status_code == 404:
raise LookupError(f"{name} does not exist on PyPI; check spelling") Try / catch
from poetry.repositories.exceptions import PackageNotFoundError
try:
info = pypi_repo.get_package_info(canonicalize_name(name))
except PackageNotFoundError:
log.error("%s not found on PyPI; verify the name", name)
raise Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- The PyPI repository cannot be configured with a custom url.
- No valid distribution links found for package: "{data.name}"
- Package [{name}] not found.
- Package {name} ({version}) not found.
- Package {name} ({version}) not found.
AI-assisted analysis of python-poetry/poetry@92b74dcfe3 (2026-08-04).
Data as JSON: /data/errors/49d627b8db68e647.json.
Report an issue: GitHub.