Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry does not clean up unfinished downloads when canceling resulting in errors #3496

Closed
3 tasks done
atigbadr opened this issue Dec 16, 2020 · 4 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@atigbadr
Copy link

atigbadr commented Dec 16, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • Manjaro Linux 20.2 (Nibia):
  • 1.1.4*:
  • Not needed:

Issue

I have been playing around with poetry when i came into an interesting bug, i've initialized a project and started adding packages using poetry add package

However when i cancel a package mid installation, and the next time i try to upgrade the package with poetry add package@latest i get the following error:

EnvCommandError

  Command ['/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/bin/pip', 'install', '--no-deps', 'file:///home/badr/.cache/pypoetry/artifacts/28/f1/1f/0c02253ed24d65eeec11e5e60bda6c8ef6695aca52cffdfaef1d854be3/scipy-1.5.4-cp38-cp38-manylinux1_x86_64.whl'] errored with the following return code 2, and output: 
  Looking in indexes: https://casa.registry.saas.cagip.gca/api/pypi/casa-datalab-pypi-scratch-intranet/simple, https://casa.registry.saas.cagip.gca/api/pypi/pypi-remote/simple
  Processing /home/badr/.cache/pypoetry/artifacts/28/f1/1f/0c02253ed24d65eeec11e5e60bda6c8ef6695aca52cffdfaef1d854be3/scipy-1.5.4-cp38-cp38-manylinux1_x86_64.whl
  ERROR: Exception:
  Traceback (most recent call last):
    File "/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
      status = self.run(options, args)
    File "/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
      return func(self, options, args)
    File "/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 324, in run
      requirement_set = resolver.resolve(
    File "/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
      discovered_reqs.extend(self._resolve_one(requirement_set, req))
    File "/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/lib/python3.8/site-packages/pip/_internal/resolution/legacy/resolver.py", line 391, in _resolve_one
      dist = abstract_dist.get_pkg_resources_distribution()
    File "/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/lib/python3.8/site-packages/pip/_internal/distributions/wheel.py", line 29, in get_pkg_resources_distribution
      with ZipFile(self.req.local_file_path, allowZip64=True) as z:
    File "/home/badr/miniconda3/lib/python3.8/zipfile.py", line 1269, in __init__
      self._RealGetContents()
    File "/home/badr/miniconda3/lib/python3.8/zipfile.py", line 1336, in _RealGetContents
      raise BadZipFile("File is not a zip file")
  zipfile.BadZipFile: File is not a zip file
  WARNING: You are using pip version 20.2.2; however, version 20.3.3 is available.
  You should consider upgrading via the '/home/badr/.cache/pypoetry/virtualenvs/test-1TUJnh2D-py3.8/bin/python -m pip install --upgrade pip' command.
  

  at ~/.poetry/lib/poetry/utils/env.py:1074 in _run
      1070output = subprocess.check_output(
      1071cmd, stderr=subprocess.STDOUT, **kwargs
      1072│                 )
      1073except CalledProcessError as e:
    → 1074raise EnvCommandError(e, input=input_)
      10751076return decode(output)
      10771078def execute(self, bin, *args, **kwargs):

In order to resolve this i have to clean up all the artificats manually for example /home/badr/.cache/pypoetry/artifacts/28/f1/1f/0c02253ed24d65eeec11e5e60bda6c8ef6695aca52cffdfaef1d854be3/scipy-1.5.4-cp38-cp38-manylinux1_x86_64.whl

How to reproduce this bug:

  1. poetry init
  2. poetry add scitkit-learn
  3. Ctrl-C mid installation
  4. poetry add scitkit-learn@latest
  5. Notice error

It seems to be trouble some, i have experieced the same issue when i lost internet mid package downloads, it would be nice if poetry could clean up these unfinished packages.

@atigbadr atigbadr added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 16, 2020
@mario-bermonti
Copy link

I can confirm this happens to me on MacOS, python 3.7.0, pip 20.2.2, poetry 1.1.4. It occurs with some packages (ex., pytest), but not others. However, it occurs even if the installation is not canceled. It just happens. I am able to solve the issue by removing all artifacts manually as done by @atigbadr and @alimantu in issue #2388.

Should I open a new issue if in my case it happens even when the download is not canceled?

@mario-bermonti
Copy link

It works if I disable the new installer as was recommended by @abn in issue #2388

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants