Skip to content

Older (yet still supported) versions of pip crash when invoked through the alias. #412

Description

@hungarian-notation

Install source and version

  • Installed from the Windows Store
  • Installed with the MSIX from python.org
  • Installed with the MSI from python.org
  • Installed with winget install 9NQ7512CXL7T

Version: 26.3

Describe the bug
Broken global pip when installing some versions of python.

Pip 23.0.1 from Python 3.10 crashes when invoked through its alias with the following trace:

Traceback (most recent call last):
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Python\bin\pip.exe.__script__.py", line 33, in <module>
    from pip._internal.cli.main import main
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 945, in _find_spec
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Python\pythoncore-3.10-64\lib\site-packages\_distutils_hack\__init__.py", line 97, in find_spec
    return method()
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Python\pythoncore-3.10-64\lib\site-packages\_distutils_hack\__init__.py", line 145, in spec_for_pip
    if self.pip_imported_during_build():
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Python\pythoncore-3.10-64\lib\site-packages\_distutils_hack\__init__.py", line 157, in pip_imported_during_build
    return any(
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Python\pythoncore-3.10-64\lib\site-packages\_distutils_hack\__init__.py", line 158, in <genexpr>
    cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None)
  File "C:\Users\WDAGUtilityAccount\AppData\Local\Python\pythoncore-3.10-64\lib\site-packages\_distutils_hack\__init__.py", line 167, in frame_file_is_setup
    return frame.f_globals.get('__file__', '').endswith('setup.py')
AttributeError: 'NoneType' object has no attribute 'endswith'

To Reproduce

  • I paste python-manager-26.3.msi into a fresh Windows Sandbox.
  • I run the installer.
  • I run py install 3.10
  • I add C:\Users\WDAGUtilityAccount\AppData\Local\Python\bin to PATH
  • I run pip, causing the crash.

Additional context
I did not interact with the sandbox VM in any way besides pasting the installer, opening and reopening Powershell, and running the commands as described above.

combined console transcript of reproduction

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions