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

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

Closed
abn opened this issue Apr 17, 2021 · 3 comments · Fixed by #3967
Closed

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

abn opened this issue Apr 17, 2021 · 3 comments · Fixed by #3967

Comments

@abn
Copy link
Member

abn commented Apr 17, 2021

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)

@abn
Copy link
Member Author

abn commented Apr 17, 2021

This is likely related to #3900.

@fredrikaverpil
Copy link
Contributor

fredrikaverpil commented Apr 17, 2021

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.

@abn abn closed this as completed in #3967 May 6, 2021
abn added a commit that referenced this issue May 6, 2021
Resolves: #3964
Co-authored-by: Sébastien Eustace <sebastien.eustace@gmail.com>
Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants