-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[python3] Bootstrap pip with ${CURRENT_INSTALLED_DIR} embedded #22386
Conversation
I'm not sure about that. |
Installing packages into |
|
ensurepip embeds installation directory into the resulting pip.exe |
I understand why deferring ensurepip might be desirable to avoid the wrong path being embedded into pip.exe. But, this breaks the workflow of the port - when Python3 is requested by It would be better, in my opinion, to do as @JackBoosY suggests and fix pip.exe to be built with relative paths as a opposed to simply deleting pip. |
The problem is actually not in Python code, but in pip: it hardcodes sys.executable (full path to current python executable, at the time when ensurepip is executed) into the resulting pip3.exe binary. I suggested a fix upstream (pip) to use current python interpreter (as found in PATH) instead of hardcoded (during build phase) but they say current behavior is intentional: See also pypa/pip#10442 pypa/pip#10700 Please also note that ensurepip ships with pre-built pip wheel, so modifying pip used by ensurepip (or building a patched pip wheel and not using ensurepip) is rather complicated and does not seem to be adequate during python build. |
According to the maintainer's comment:
This shows that the pipe doesn't support "removability", so I think we can point the absolute path it uses to CURRENT_INSTALLED_DIR or CURRENT_HOST_INSTALLED_DIR? |
@JackBoosY the absolute path is embedded during pip installation into the resulting .exe While we can patch it to point to $CURRENT_INSTALLED_DIR instead of $CURRENT_PACKAGES_DIR, please note that python3 port does not execute "python -m ensurepip" during installation (so on Linux we don't have pip installed) @Hoikas what do you think? |
The new version enforces installed pip executables to have $CURRENT_INSTALLED_DIR embedded |
But |
The unix codepath passes |
|
Yes, but I wanted to keep the contract at least during the build (when python3 is a dependency)
That's what my original patch did. And that's what standard python installer does - it runs ensurepip at post-install phase |
We should find a way to patch this. |
Can we push this fix as currently pip is not usable at all and more over - it installs modules into ${CURRENT_PACKAGES_DIR} (at the time of building) Patching pip is not an easy thing to do and should be a subject of a different PR. Also, please remove requires:author-response tag. |
@strega-nil-ms @BillyONeal @ras0219-msft Can you please take a look at this PR? Thanks. |
Can this one be reviewed? |
This is not necessarily the contract we should expose -- for example, if pip cannot be relocated, we cannot provide pip. Based on the above comment thread, following the links, and doing separate research, I don't think we can provide pip in the package: it is fundamentally unrelocatable. However, the python we install does have
Because vcpkg is not a general purpose application package manager, I think this is the right contact for us to fulfill. Users should never mutate the vcpkg installed directory -- they should never install additional packages directly into vcpkg. Therefore a virtual environment is mandatory anyway. I've opened #24906 which takes this alternate approach and instead documents how users can use |
I think with #24906 this can be closed? Thanks! |
[python3] Do not bootstrap pip: bootstrapped pip executables
have ${CURRENT_PACKAGES_DIR} embedded so that pip.exe even if
executed from ${CURRENT_INSTALLED_DIR} installs packages into
${CURRENT_PACKAGES_DIR}
pip should be bootstrapped in post-install step (which vcpkg
does not currently implement)
Users can always bootstrap pip manually by runing "python -m ensurepip"
Describe the pull request
What does your PR fix?
None
Which triplets are supported/not supported? Have you updated the CI baseline?
all
Does your PR follow the maintainer guide?
Yes
If you have added/updated a port: Have you run
./vcpkg x-add-version --all
and committed the result?Yes
If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/