Skip to content

Commit d29c2c0

Browse files
Suggest cache clear after fresh package info from --no-cache resolves installation candidate problems (#10585)
1 parent 436b1be commit d29c2c0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/poetry/installation/chooser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ def _no_links_found_error(
177177
f"Make sure the lockfile is up-to-date. You can try one of the following;\n\n"
178178
f" 1. <b>Regenerate lockfile: </><fg=yellow>poetry lock --no-cache --regenerate</>\n"
179179
f" 2. <b>Update package : </><fg=yellow>poetry update --no-cache {package.name}</>\n\n"
180+
# FIXME: In the future, it would be better to suggest a more targeted
181+
# cache clear command for just the package in question. E.g.
182+
# `poetry cache clear {package.source_reference}:{package.name}:{package.version}`
183+
# but `package.source_reference` currently resolves to `None` because
184+
# repository names are case sensitive at the moment (`PyPI` vs `pypi`).
185+
f"If any of those solutions worked, you will have to clear your caches using (<c1>poetry cache clear --all</>).\n\n"
180186
f"If neither works, please first check to verify that the {package.name} has published wheels "
181187
f"available from your configured source{source_hint} that are compatible with your environment"
182188
f"- ie. operating system, architecture (x86_64, arm64 etc.), python interpreter."

tests/installation/test_chooser_errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def test_chooser_no_links_found_error(env: MockEnv, pool: RepositoryPool) -> Non
5757
1. Regenerate lockfile: poetry lock --no-cache --regenerate
5858
2. Update package : poetry update --no-cache {package.name}
5959
60+
If any of those solutions worked, you will have to clear your caches using (poetry cache clear --all).
61+
6062
If neither works, please first check to verify that the {package.name} has published wheels available from your configured \
6163
source ({package.source_reference}) that are compatible with your environment- ie. operating system, architecture \
6264
(x86_64, arm64 etc.), python interpreter.\
@@ -81,6 +83,8 @@ def test_chooser_no_links_found_error(env: MockEnv, pool: RepositoryPool) -> Non
8183
1. Regenerate lockfile: poetry lock --no-cache --regenerate
8284
2. Update package : poetry update --no-cache {package.name}
8385
86+
If any of those solutions worked, you will have to clear your caches using (poetry cache clear --all).
87+
8488
If neither works, please first check to verify that the {package.name} has published wheels available from your configured \
8589
source ({package.source_reference}) that are compatible with your environment- ie. operating system, architecture \
8690
(x86_64, arm64 etc.), python interpreter.

0 commit comments

Comments
 (0)