Skip to content

Race condition in new installer (1.1.0rc1) with --remove-untracked #2658

@PetterS

Description

@PetterS

To reproduce:

  • Add ipython = "*" as a dev dependency to a repo.
  • poetry lock
  • poetry install
  • Remove it again.
  • poetry lock
  • poerty install --remove-untracked

I get this:

Installing dependencies from lock file

Package operations: 0 installs, 0 updates, 15 removals

  • Removing backcall (0.2.0)
  • Removing decorator (4.4.2)
  • Removing ipython (7.16.1): Failed

  EnvCommandError

  Command ['/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/bin/python', '-m', 'pip', 'uninstall', 'ipython', '-y'] errored with the following return code 2, and output:
  ERROR: Exception:
  Traceback (most recent call last):
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
      status = self.run(options, args)
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 51, in run
      session = self.get_default_session(options)
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 74, in get_default_session
      self._session = self.enter_context(self._build_session(options))
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 84, in _build_session
      session = PipSession(
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/network/session.py", line 241, in __init__
      self.headers["User-Agent"] = user_agent()
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/network/session.py", line 159, in user_agent
      setuptools_version = get_installed_version("setuptools")
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 637, in get_installed_version
      working_set = pkg_resources.WorkingSet()
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 567, in __init__
      self.add_entry(entry)
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 623, in add_entry
      for dist in find_distributions(entry, True):
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2065, in find_on_path
      for dist in factory(fullpath):
    File "/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2127, in distributions_from_metadata
      if len(os.listdir(path)) == 0:
  FileNotFoundError: [Errno 2] No such file or directory: '/home/petter/.cache/pypoetry/virtualenvs/openai-test-cYZNiyR8-py3.8/lib/python3.8/site-packages/~typrocess-0.6.0.dist-info'


  at /usr/local/lib/python3.8/dist-packages/poetry/utils/env.py:937 in _run
       933│                 output = subprocess.check_output(
       934│                     cmd, stderr=subprocess.STDOUT, **kwargs
       935│                 )
       936│         except CalledProcessError as e:
    →  937│             raise EnvCommandError(e, input=input_)
       938│
       939│         return decode(output)
       940│
       941│     def execute(self, bin, *args, **kwargs):

  • Removing ipython-genutils (0.2.0)
  • Removing jedi (0.17.1)
  • Removing parso (0.7.0)
  • Removing pickleshare (0.7.5)
  • Removing pkg-resources (0.0.0)
  • Removing prompt-toolkit (3.0.5)
  • Removing ptyprocess (0.6.0)
  • Removing pygments (2.6.1)
  • Removing pexpect (4.8.0)
  • Removing six (1.15.0)
  • Removing traitlets (4.3.3)
  • Removing wcwidth (0.2.5)

I don't know what site-packages/~typrocess-0.6.0.dist-info' is but my guess is that it has something to do with the parallel processing. Runing the command again fixes the issue.

I suggest that we do not process uninstalls in parallel unless this is easy to fix. I don't know how to fix this. @sdispater wrote the new installer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions