-
Notifications
You must be signed in to change notification settings - Fork 92
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
Fix behavior when missing Pip #6020
base: main
Are you sure you want to change the base?
Conversation
Updated UI prompt to include Pip in the modules to be installed when missing, and updated installer logic to actually do that.
All contributors have signed the CLA ✍️ ✅ |
E2E Tests 🚀 |
I have read the CLA Document and I hereby sign the CLA |
Revised l10n call to conform better to the localization API
Mocked up environment to ensure that Pip gets installed when `ModuleInstallFlags.installPipIfRequired` is set
Added a unit test to check the business logic of installing Pip; do we need an e2e test? |
P.S., a screencap of the new behavior: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, I tried it out and it seems to work well! (Can't tell if the test failures are related to this PR or not)
ModuleInstallFlags.installPipIfRequired, | ||
); | ||
expect(result).to.equal(InstallerResponse.Installed, 'Should be Installed'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test!
let message; | ||
if (!hasPip) { | ||
message = vscode.l10n.t( | ||
'To enable Python support, Positron needs to {0} the packages <code>{1}</code> and <code>{2}</code> for the active interpreter {3} at: <code>{4}</code>.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change the header of the popup too? Right now it says Install Python package "ipykernel"?
even if the body asks to install pip too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - good catch! I'll check out implementing this too. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is pip a Python package itself? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! A package which exposes a console script.
In this case, it is being installed by the ensurepip
builtin module.
Also removes an unnecessary Positron overlay comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great and working well for me!
With no pip or ipykernel (note that we should update the header as pointed out by @austin3dickey):
With no ipykernel only:
We mostly, sort of support uv right now and certainly want to do better for uv users as we move forward; what happens if someone is using uv? In term of us detecting if pip is there or not? See https://docs.astral.sh/uv/pip/compatibility/
And then same question for conda, which do expect to work in Positron well. I believe that currently for conda environments, the call to this.install()
uses conda not pip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't look like the tests failures are related to these changes since it looks like they're failing in setup (?). it might be worth trying to kick them off again. nice tests and the change looks reasonable to me!
The CI failures definitely look unrelated, and sadly we are having some MASSIVE CI PROBLEMS right now as runners moved to Ubuntu 24. Let's not merge this until we get an all clear from QA folks on the situation on |
FWIW I set up my local test by doing |
UV behavior: As Austin said, no Pip, but it gets installed per the new behavior. Is this what we want (vs. Conda behavior: I created a conda environment with just Python (+ required dependencies). I got no prompt to install |
I do not think we should install pip into uv environments, no. I don't know if we can install ipykernel into uv easily right now (does it exist as one of the installer types already?) but solving that is probably out of scope for this PR. Let's think about this PR as installing pip when needed for non-conda, non-uv environments. |
When selecting an interpreter missing ipykernel, the UI prompt now states that both Pip and ipykernel must be installed.
ProductInstaller
logic was modified to pass flags to enable Pip to be installed automatically. Additional flags were set inProductInstaller
to enable the Pip install to respect thepython.installModulesInTerminal
setting.Addresses #5505
Release Notes
New Features
Bug Fixes
QA Notes