From 3c3a2a7d28caa40cdae8f780c8494d9bf8839d58 Mon Sep 17 00:00:00 2001 From: Jamie Stackhouse <1956521+itsjamie@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:49:06 -0300 Subject: [PATCH 1/5] Add --no-cache-dir to prevent false positives of PEP-517 support. When trying to determine if the issue was because of Poetry or the package not supporting PEP-517 mode, it is possible that the pip cache can result in false positives of packages that support PEP-517. An example of this is the issue #8462. This PR adds to the error output and recommended command to prevent this from happening in the future. As a new user to Python, it wasn't immediately obvious to me when running on the command line why it succeeded, and simply took that it did as enough confirmation that opening an issue was valid. --- src/poetry/installation/executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/poetry/installation/executor.py b/src/poetry/installation/executor.py index 4103da299f0..2aa49fa0ce8 100644 --- a/src/poetry/installation/executor.py +++ b/src/poetry/installation/executor.py @@ -331,7 +331,7 @@ def _execute_operation(self, operation: Operation) -> None: " and is likely not a problem with poetry" f" but with {pkg.pretty_name} ({pkg.full_pretty_version})" " not supporting PEP 517 builds. You can verify this by" - f" running '{pip_command} \"{requirement}\"'." + f" running '{pip_command} --no-cache-dir \"{requirement}\"'." "" ) elif isinstance(e, SolverProblemError): From d63d069f34d7218bcea38e0d620fd36a525e5fa7 Mon Sep 17 00:00:00 2001 From: Jamie Stackhouse <1956521+itsjamie@users.noreply.github.com> Date: Fri, 22 Sep 2023 16:56:39 -0300 Subject: [PATCH 2/5] Add --no-cache-dir to executor test. --- tests/installation/test_executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index 3a3fc357a2a..a55229f28d8 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -1299,7 +1299,7 @@ def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess( expected_end = f""" Note: This error originates from the build backend, and is likely not a problem with \ poetry but with {package_name} ({package_version} {package_url}) not supporting \ -PEP 517 builds. You can verify this by running '{pip_command} "{requirement}"'. +PEP 517 builds. You can verify this by running '{pip_command} --no-cache-dir "{requirement}"'. """ From 6dc9090c1cc73eb1d385c0ca021995e7c7a08252 Mon Sep 17 00:00:00 2001 From: Jamie Stackhouse <1956521+itsjamie@users.noreply.github.com> Date: Fri, 22 Sep 2023 17:02:52 -0300 Subject: [PATCH 3/5] Resolve linting issue of line too long. --- tests/installation/test_executor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index a55229f28d8..f8f53838fbc 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -1299,7 +1299,8 @@ def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess( expected_end = f""" Note: This error originates from the build backend, and is likely not a problem with \ poetry but with {package_name} ({package_version} {package_url}) not supporting \ -PEP 517 builds. You can verify this by running '{pip_command} --no-cache-dir "{requirement}"'. +PEP 517 builds. You can verify this by running \ +'{pip_command} --no-cache-dir "{requirement}"'. """ From 26cc1221ef1fd151ef74216b340dac878fbb487c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Sat, 23 Sep 2023 15:46:26 +0200 Subject: [PATCH 4/5] minor refactoring --- src/poetry/installation/executor.py | 4 ++-- tests/installation/test_executor.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/poetry/installation/executor.py b/src/poetry/installation/executor.py index 2aa49fa0ce8..171616d6d00 100644 --- a/src/poetry/installation/executor.py +++ b/src/poetry/installation/executor.py @@ -316,7 +316,7 @@ def _execute_operation(self, operation: Operation) -> None: trace.render(io) if isinstance(e, ChefBuildError): pkg = operation.package - pip_command = "pip wheel --use-pep517" + pip_command = "pip wheel --no-cache-dir --use-pep517" if pkg.develop: requirement = pkg.source_url pip_command += " --editable" @@ -331,7 +331,7 @@ def _execute_operation(self, operation: Operation) -> None: " and is likely not a problem with poetry" f" but with {pkg.pretty_name} ({pkg.full_pretty_version})" " not supporting PEP 517 builds. You can verify this by" - f" running '{pip_command} --no-cache-dir \"{requirement}\"'." + f" running '{pip_command} \"{requirement}\"'." "" ) elif isinstance(e, SolverProblemError): diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index f8f53838fbc..0aefd09ae79 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -1290,17 +1290,17 @@ def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess( assert directory_package.source_url is not None if editable: - pip_command = "pip wheel --use-pep517 --editable" + pip_command = "pip wheel --no-cache-dir --use-pep517 --editable" requirement = directory_package.source_url assert Path(requirement).exists() else: - pip_command = "pip wheel --use-pep517" + pip_command = "pip wheel --no-cache-dir --use-pep517" requirement = f"{package_name} @ {path_to_url(directory_package.source_url)}" expected_end = f""" Note: This error originates from the build backend, and is likely not a problem with \ poetry but with {package_name} ({package_version} {package_url}) not supporting \ PEP 517 builds. You can verify this by running \ -'{pip_command} --no-cache-dir "{requirement}"'. +'{pip_command} "{requirement}"'. """ From 4aec51143d1a2445abc42662960fa9cb272495dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Sat, 23 Sep 2023 15:51:28 +0200 Subject: [PATCH 5/5] remove unnecessary line break --- tests/installation/test_executor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/installation/test_executor.py b/tests/installation/test_executor.py index 0aefd09ae79..3a921711242 100644 --- a/tests/installation/test_executor.py +++ b/tests/installation/test_executor.py @@ -1299,8 +1299,7 @@ def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess( expected_end = f""" Note: This error originates from the build backend, and is likely not a problem with \ poetry but with {package_name} ({package_version} {package_url}) not supporting \ -PEP 517 builds. You can verify this by running \ -'{pip_command} "{requirement}"'. +PEP 517 builds. You can verify this by running '{pip_command} "{requirement}"'. """