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

Code Editor setting for Python IntelliSense in Jupyter notebooks #319

Open
SeijiSuenaga opened this issue Mar 28, 2024 · 14 comments
Open

Code Editor setting for Python IntelliSense in Jupyter notebooks #319

SeijiSuenaga opened this issue Mar 28, 2024 · 14 comments

Comments

@SeijiSuenaga
Copy link

SeijiSuenaga commented Mar 28, 2024

When using Code Editor in SageMaker Studio (where the latest available distribution is currently 1.5), I've found that Python cells in Jupyter notebooks have no IntelliSense unless I configure this setting, then reload the page:

"python.languageServer": "Jedi"

Would it be acceptable to add that to template/v1/dirs/etc/code-editor/code_editor_machine_settings.json?

The problem might be resolved in a newer version of the Jupyter extension, judging by microsoft/vscode-jupyter#12494, but unfortunately the latest version on open-vsx.org is 6+ months out of date. 😕

@edwardps
Copy link

edwardps commented Apr 1, 2024

Thanks Seiji for reporting this. We will track this request and evaluate the default languageServer configuration internally.

@claytonparnell
Copy link
Contributor

@edwardps are there any updates we can share here?

@j0bekt01
Copy link

j0bekt01 commented Nov 1, 2024

With notebooks, IntelliSense defaults to Jedi. Set it to Pylance instead, as it is much more feature-rich than Jedi. You can add "python.languageServer": "Pylance" to your startup lifecycle policy.

@SeijiSuenaga
Copy link
Author

@j0bekt01 Does that require Pylance to be installed? As far as I know, the Pylance extension isn't available in Code Editor because Microsoft restricts it to their proprietary VS Code distribution.

@j0bekt01
Copy link

j0bekt01 commented Nov 4, 2024

There's a Python extension that's already installed in our SM so I either go to the extension settings and pick Pylance over Jedi or append the line above to the settings file.

@pjoe
Copy link

pjoe commented Nov 5, 2024

I think @SeijiSuenaga is correct. When you select pylance code editor prompts to install the extension ms-python.vscode-pylance, but is unable to do so. I tried manually downloading the vsix, but this also fails installing, with an error about vscode version. Also noticed that extension is not on OpenVSX :S

@pjoe
Copy link

pjoe commented Nov 5, 2024

Jedi does enable some limited intellisense for python stdlibs, but nothing for e.g. spark :S

image

@j0bekt01
Copy link

j0bekt01 commented Nov 5, 2024

I think @SeijiSuenaga is correct. When you select pylance code editor prompts to install the extension ms-python.vscode-pylance, but is unable to do so. I tried manually downloading the vsix, but this also fails installing, with an error about vscode version. Also noticed that extension is not on OpenVSX :S

This extension is on openVSX
https://open-vsx.org/extension/ms-python/python

it should already be baked into the distribution image see here: https://github.com/aws/sagemaker-distribution/blob/main/build_artifacts/v2/v2.0/v2.0.0/dirs/etc/code-editor/extensions.txt

@pjoe
Copy link

pjoe commented Nov 6, 2024

@j0bekt01 this is not the same extension, we are talking about the pylance extension, NOT the python extension, see here:

https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance

vs.

https://marketplace.visualstudio.com/items?itemName=ms-python.python

note the different IDs ms-python.python vs. ms-python.vscode-pylance

@j0bekt01
Copy link

j0bekt01 commented Nov 6, 2024

@j0bekt01 this is not the same extension, we are talking about the pylance extension, NOT the python extension, see here:

https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance

vs.

https://marketplace.visualstudio.com/items?itemName=ms-python.python

note the different IDs ms-python.python vs. ms-python.vscode-pylance

oh, I see. The openvsx one should have support for pylance

@pjoe
Copy link

pjoe commented Nov 6, 2024

It's not quite like that.

ms-python.python has support for automatically installing ms-python.vscode-pylance. However installing the pylance extension is what fails

@imarquart
Copy link

pylance does not exist on openvsx and we were not successful activating Pylance in any sort of configuration.
The OpenVSX python extension can not install Pylance, as it does not exist. It fails in installing Pylance, but does so silently. Setting LanguageServer to Pylance then leads to no Python support at all. Jedi is, of course, vastly inferior.

As such:

  • Is there any way to remediate this issue?
  • Are there any plans to provide better Python support?

If there really isn't any way to do this, or if the AWS team really is not aware of the issue, I also have the following question:

  • Has anyone at AWS actually ever tried productive coding in Python using Sagemaker?

@SeijiSuenaga
Copy link
Author

SeijiSuenaga commented Nov 20, 2024

@imarquart FWIW, for plain .py files you can install the Pyright extension, which Pylance is built upon. It includes some basic language server features like renaming variables, but it intentionally doesn't support notebooks. There is also a Pyright fork called basedpyright that re-implements some Pylance features, but it currently doesn't support notebooks either.☹️

Since Microsoft made Pylance proprietary, I feel like the Python ecosystem desperately needs an open-source alternative that works in notebooks, but I haven't found one yet. It'd be awesome if AWS used some of their vast resources to improve this tooling in SageMaker...

@Julfried
Copy link

I can 100% agree here. Currently working on Sagemaker Code Instances is just not that great, as there is no syntax highlighting and proper intelisense configuration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants