Skip to content

The following sequence leaves folders behind in site-packages (master) #3964

Closed

Description

@abn

On my machine, the following sequence leaves folders behind in site-packages:

Install b from path:

$ poetry@3940 add ../b/

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing b (0.0.0 /home/fredrik/code/repos/b): Building...

Then I wanted to see what happens if I try to add it again but with the --editable arg:

$ poetry@3940 add --editable ../b/

Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 0 installs, 1 update, 0 removals

  • Updating b (2.1.3.dev0+g77bcc5e.d20210417114942 /home/fredrik/code/repos/b -> 0.0.0 /home/fredrik/code/repos/b)

Finally uninstalling b:

$ poetry@3940 remove b
Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 0 installs, 0 updates, 1 removal

  • Removing b (0.0.0 /home/fredrik/code/repos/b)

But unfortunately, b was not completely removed, likely due to the fact that I was able to run poetry add twice:

image

And now it seems the .venv is b0rked, as there is suddenly a None package:

$ poetry@3940 show

  TypeError

  expected string or bytes-like object

  at ~/.local/pipx/venvs/poetry@3940/lib/python3.9/site-packages/poetry/core/utils/helpers.py:27 in canonicalize_name
       23│ _canonicalize_regex = re.compile(r"[-_]+")
       24│
       25│
       26│ def canonicalize_name(name: str) -> str:
    →  27│     return _canonicalize_regex.sub("-", name).lower()
       28│
       29│
       30│ def module_name(name: str) -> str:
       31│     return canonicalize_name(name).replace(".", "_").replace("-", "_")

Originally posted by @fredrikaverpil in #3940 (comment)

Activity

  1. abn commented on Apr 17, 2021

    @abn
    MemberAuthor

    This is likely related to #3900.

  2. fredrikaverpil commented on Apr 17, 2021

    @fredrikaverpil
    Contributor

    This can be reproduced by just doing this:

    poetry add /path/to/mypkg
    poetry remove mypkg

    I don't know if you want to do it like this, but at least this patch actually fixes the issue: #3967
    The solution was to add the direct_url.json to RECORD, after the .json file was created.

    But something tells me importlib is supposed to scan for this file, and add it to RECORD if it detects it?
    I've reached out here and asked if this file should be added to RECORD.

  3. added a commit that references this issue on May 6, 2021
    436c2a1
  4. github-actions commented on Mar 2, 2024

    @github-actions

    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.

  5. locked as resolved and limited conversation to collaborators on Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions