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

Correctly handle tilde directories in site-packages #9658

Closed
1 task done
bersbersbers opened this issue Feb 26, 2021 · 3 comments
Closed
1 task done

Correctly handle tilde directories in site-packages #9658

bersbersbers opened this issue Feb 26, 2021 · 3 comments
Labels
resolution: duplicate Duplicate of an existing issue/PR

Comments

@bersbersbers
Copy link

bersbersbers commented Feb 26, 2021

pip version

21.0.1

Python version

3.8.5

OS

Windows 10

Additional information

No response

Description

From time to time, I get folder situations like this in my site-packages folder (C:\Programs\Python\Python38\Lib\site-packages), see image below. This generates all kinds of problems, such as

C:\>pip list --format=freeze
-ffi==1.14.4
2to3==1.0
absl-py==0.11.0
...
C:\>pip freeze
WARNING: Could not generate requirement for distribution -ffi 1.14.4 (c:\users\bers\appdata\local\programs\python\python38\lib\site-packages): Parse error at "'-ffi==1.'": Expected W:(abcd...)
2to3==1.0
absl-py==0.11.0

Expected behavior

I am not sure. Probably, pip should at least ignore these directories. Possibly delete them. Maybe never even create them.

How to Reproduce

I don't know. I think it happens when package (here: cffi, I guess) upgrades fail (sometimes they do due to permissions, which may be due other still-running python processes), but I cannot easily reproduce.

Output

No response

Code of Conduct

  • I agree to follow the PSF Code of Conduct

image
image

@bersbersbers bersbersbers added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Feb 26, 2021
@uranusjr
Copy link
Member

#7269.

BTW the character - is a dash, not a tilde (~).

@uranusjr uranusjr added resolution: duplicate Duplicate of an existing issue/PR and removed S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Feb 27, 2021
@bersbersbers
Copy link
Author

bersbersbers commented Feb 28, 2021

#7269.

Thanks!

BTW the character - is a dash, not a tilde (~).

That's correct. The character used in the file system is a tilde, however (see also my first screenshot):

# We always prepend a ~ and then rotate through these until

new_name = "~" + "".join(candidate) + name[i:]

@uranusjr
Copy link
Member

uranusjr commented Feb 28, 2021

Looks like the pip freeze output becomes a dash due to some pkg_resources quirks. Thanks for digging into the details for this!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

2 participants