You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support automatic recognition of pixi environments in IDEs: VS Code #411
As discussed on Discord, there currently isn't a proper integration with VS Code yet.
It would be great if pixi environments automagically show up when selecting the Python interpreter via Python: Select Interpreter (see VS Code Python Interpreter Docs), as do conda, poetry, venv and other environments.
Reacted by Andreas Reich, Marnix, Hadrien Mary, amnesic, Daniel Saier, Moritz Wilksch, Nodar Okroshiashvili, byterube, Renan Santos, Morten Enemark Lund and 21 more
I would really love that! But I really hope that it could be made without any ties to Python. I really like that Pixi positions itself as being cross-platform and ecosystem-agnostic. So many people don't see Conda as a general-purpose package manager, because they think it's Python-only. And I see where it comes from, but I hope it won't be the case for Pixi.
E.g. direnv has nice VS Code extensions that would load the environment into the IDE on startup. Probably something like that could be done for Pixi.
Reacted by Daniel Saier, Mikkel Roald-Arbøl, Silvio Traversaro and jfchenier
Reacted by Pavel Zwerschke, Zaubeerer, Nodar Okroshiashvili, byterube, Jason Wohlgemuth, Renan Santos, Moritz Wilksch, binarytahr, Michael Beyeler, Dante Oz and 7 more
Reacted by Pavel Zwerschke, Zaubeerer, Nodar Okroshiashvili, Michael Beyeler, Cornelius Roemer and Takieddine Kadiri
It seems there is a problem for jupyter notebooks inside vscode. It is possible to manually specify a pixi python interpreter as kernel but vscode does not detect ipykernel even if it is installed:
Running cells with 'envs/.pixi/envs/default/bin/python' requires the ipykernel package.
Run the following command to install 'ipykernel' into the Python environment.
A side effect of no auto-discovery is that if you initialise a new project and create a Jupyter notebook - VSCode won't show you any Pixi kernels before you firstly, create any .py file and manually select your Pixi env's Python interpreter. After a restart of the Jupyter notebook, you will be able to use that Pixi Python interpreter as a kernel without having to run any kernel creation commands manually. I assume most VSCode users will be used to this pattern by now, but thought I'd mention it incase anyone is doing that dance for the first time 😁
Reacted by Moritz Wilksch, Zaubeerer, Zhongli Wu, Qiusheng Wu and Mikhail Kuznetsov
Activity
burdiyan commentedon Dec 2, 2023
I would really love that! But I really hope that it could be made without any ties to Python. I really like that Pixi positions itself as being cross-platform and ecosystem-agnostic. So many people don't see Conda as a general-purpose package manager, because they think it's Python-only. And I see where it comes from, but I hope it won't be the case for Pixi.
E.g. direnv has nice VS Code extensions that would load the environment into the IDE on startup. Probably something like that could be done for Pixi.
baszalmstra commentedon Feb 26, 2024
I started some initial work here: microsoft/vscode-python#22968
Lets see what happens!
j-bac commentedon Apr 2, 2024
It seems there is a problem for jupyter notebooks inside vscode. It is possible to manually specify a pixi python interpreter as kernel but vscode does not detect ipykernel even if it is installed:
ruben-arts commentedon Apr 2, 2024
@j-bac is
ipykernelin the same environments as thepythoninterpeter you specify here?j-bac commentedon Apr 2, 2024
Yes it is part of the pixi.toml (which defines a single environment)
abkfenris commentedon Apr 2, 2024
I was able to get the IPython kernel to work in VS Code by running the kernelspec install inside the pixi environment.
j-bac commentedon Apr 2, 2024
Thanks that worked!
b4rlw commentedon May 13, 2024
A side effect of no auto-discovery is that if you initialise a new project and create a Jupyter notebook - VSCode won't show you any Pixi kernels before you firstly, create any
.pyfile and manually select your Pixi env's Python interpreter. After a restart of the Jupyter notebook, you will be able to use that Pixi Python interpreter as a kernel without having to run any kernel creation commands manually. I assume most VSCode users will be used to this pattern by now, but thought I'd mention it incase anyone is doing that dance for the first time 😁roaldarbol commentedon Jul 2, 2024
I guess this issue can be closed, right? Amazing work @baszalmstra! 🥳
ruben-arts commentedon Jul 9, 2024
Closing as it is included in the 2024.10.0 version: https://github.com/microsoft/vscode-python/releases/tag/v2024.10.0
visr commentedon Jul 9, 2024
Question, the release notes also mention adding support for https://github.com/microsoft/python-environment-tools. This does not support Pixi: microsoft/python-environment-tools#46. What is the difference between this and the locator? From an outsider perspective they seem to do the same.