indygreg / python-build-standalone

Produce redistributable builds of Python
BSD 3-Clause "New" or "Revised" License
1.75k stars 109 forks source link

Unable to run pip on Windows #85

Closed silverjam closed 2 years ago

silverjam commented 2 years ago

Hello @indygreg --

Thanks for the great work on these builds! I'm hoping to use one of these builds as an alternative packaging mechanism for an app we're building, to that end I'm trying out cpython-3.9.6-x86_64-pc-windows-msvc-shared-install_only-20210724T1424 and I'm attempting to run pip, but seeing the following error:

Traceback (most recent call last):
  File "C:\Users\jason\dev\python-3.9\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\jason\dev\python-3.9\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\cli\main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\cli\main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\cli\cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\cli\parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\configuration.py", line 21, in <module>
    from pip._internal.exceptions import (
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_internal\exceptions.py", line 8, in <module>
    from pip._vendor.requests.models import Request, Response
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_vendor\requests\__init__.py", line 43, in <module>
    from pip._vendor import urllib3
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_vendor\urllib3\__init__.py", line 13, in <module>
    from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
    from .connection import (
  File "C:\Users\jason\dev\python-3.9\lib\site-packages\pip-21.1.3-py3.9.egg\pip\_vendor\urllib3\connection.py", line 54, in <module>
    from .packages.ssl_match_hostname import CertificateError, match_hostname
ImportError: cannot import name 'CertificateError' from 'pip._vendor.urllib3.packages.ssl_match_hostname' (unknown location)

Is there something I need setup in the environment in order to run pip? Or do you have an alternate recommendation on how to get Python modules loaded into one of these builds?

silverjam commented 2 years ago

Interestingly if I use get-pip.py to bootstrap pip I'm able to run python -m pip afterwards.

indygreg commented 2 years ago

Commit cd2a0ff18b56b5ffd3d57ce0fc43029d33454697 changes how pip and setuptools are installed. I'm no longer able to reproduce this issue, which is good. Unfortunately, I can still reproduce #88.

The recommended way to invoke pip is via python.exe -m pip. I confirmed this works with the new builds after cd2a0ff18b56b5ffd3d57ce0fc43029d33454697.

I'm going to close this and use #88 to track the remaining issue with pip.exe not working.