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

Unable to delete packages installed as editable from Windows junction link #10696

Closed
1 task done
jiunbae opened this issue Dec 1, 2021 · 2 comments · Fixed by #10697
Closed
1 task done

Unable to delete packages installed as editable from Windows junction link #10696

jiunbae opened this issue Dec 1, 2021 · 2 comments · Fixed by #10697
Labels
type: bug A confirmed bug or unintended behavior

Comments

@jiunbae
Copy link
Contributor

jiunbae commented Dec 1, 2021

Description

If a package with a path containing a Windows junction link is installed as editable, an egg-link AssertionError occurs that the package path does not match when uninstalling.

AssertionError: Egg-link \path\that\link\include\test_pkg does not match installed location of test-pkg (at \real\package\path)

Expected behavior

Deleting or reinstalling packages should not raise AssertionError: Egg-link.

pip version

21.2.2

Python version

3.8.8

OS

Windows 10 (version 1909)

How to Reproduce

# Create or locate test package to original directory
code src\test_pkg

# Make junction link
mklink /J src-link src

# Install package over junction link path
cd src-link\test_pkg
pip install -e .

# Uninstall or re-install package over junction link
pip uninstall test_pkg

>> Raise AssertionError

Output

ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\jiunbae\conda\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
    status = self.run(options, args)
  File "C:\Users\jiunbae\conda\lib\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
    return func(self, options, args)
  File "C:\Users\jiunbae\conda\lib\site-packages\pip\_internal\commands\install.py", line 390, in run
    installed = install_given_reqs(
  File "C:\Users\jiunbae\conda\lib\site-packages\pip\_internal\req\__init__.py", line 66, in install_given_reqs
    uninstalled_pathset = requirement.uninstall(
  File "C:\Users\jiunbae\conda\lib\site-packages\pip\_internal\req\req_install.py", line 632, in uninstall
    uninstalled_pathset = UninstallPathSet.from_dist(dist)
  File "C:\Users\jiunbae\conda\lib\site-packages\pip\_internal\req\req_uninstall.py", line 527, in from_dist
    assert (link_pointer == dist.location), (
AssertionError: Egg-link e:\workspace-link\test_pkg does not match installed location of test-pkg (at e:\workspace\test_pkg)

Code of Conduct

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

uranusjr commented Dec 1, 2021

So in your error message (it seems to use different paths from the reproducing steps you provided), e:\workspace-link is a junction link to e:\workspace, right?

Could you check quickly if either pathlib.Path’s resolve() or os.path.realpath() would be able to resolve junctions?

@jiunbae
Copy link
Contributor Author

jiunbae commented Dec 1, 2021

Oh, The output's workspace-link is src-link in reproduce steps.

Yes pathlib.Path.resolve() and os.path.realpath() resolve junction.

I will create the PR from

link_pointer = os.path.normcase(fh.readline().strip())

to

link_pointer = os.path.normcase(
    os.path.realpath(fh.readline().strip())
)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2022
@pradyunsg pradyunsg removed the S: needs triage Issues/PRs that need to be triaged label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants