Skip to content

pip installer breaks environment on vcs namespace package removal #2238

@abn

Description

@abn
  • I am on 1.1.0a1, this should also affect 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).

Issue

As things stand today, if a vcs dependency is being removed, poetry first deletes the source directory in $VENV_DR/src/<pkg.name> and then proceeds to try pip uninstall <pkg.name> -y.

This will silently fail as the path being used in the installed namespace package is no longe present. Any following poetry commands will result in the following error caused when attempting to identify env.sys_path.

  JSONDecodeError

  Expecting value: line 1 column 1 (char 0)

  at /usr/lib64/python3.7/json/decoder.py:355 in raw_decode
      351|         """
      352|         try:
      353|             obj, end = self.scan_once(s, idx)
      354|         except StopIteration as err:
    > 355|             raise JSONDecodeError("Expecting value", s, err.value) from None
      356|         return obj, end
      357| 

Additionally there is also a secondary issue that will be exposed when this is fixed. This is due to pypa/pip#4176. This causes the *-nspkg.pth file to be retained even after the unininstall command succeeds, which leads to the above error again.

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