Add ability to exclude Python Environment from Python Extension #1043
Description
Currently the Jupyter extension has the ability to hide Python Environments from showing up in the Kernel picker
One of the use cases is to hide the default Python Env in docker (dev) containers from Jupyter extension as they do not work (due to lack of Pip or the like) & these containers have other Environments like Conda or the like that is preferred.
I feel that this would apply to Python extension as well, i.e. if a user tries to debug Python code or the like, one wouldn't want to see the Python Env thats not working (I.e. the creators of the Container would want to ensure users of that container always use a specific Python environment or never use a specific Python env).
Can we have a setting or the like that would take an array of Python environment paths that would exclude Python Environments from the Python Extension, this would then flow onto Jupyter as well & other extensions.
Activity
karthiknadig commentedon May 3, 2023
Don Jayamanne (@DonJayamanne) This looks like 3 separate asks, let me try to para phrase what I understood
For 2, if someone is creating a container, they should be using
python.defaultInterpreterPathto pre-select/force the python to be used for that workspace. since they control the container, they can remove what is not needed from the container./cc Kartik Raj (@karrtikr)
DonJayamanne commentedon May 11, 2023
With the Jupyter extension its not possible to pre-select kernels, users must always select a kernel.
However since they have multiple python environments users will end up selecting the wrong python env.
Not sure this is true.
Many linux container come with Python and what they do is install Conda or the like into them, thus we end up with the default Python environment as well as conda environments.
karrtikr commentedon Jul 23, 2023
Preferred environments for a container can be specified using
"python.defaultInterpreterPath"setting, maybe Jupyter could adopt that or at least highlight the configured env in the kernel list when selecting for the first time.If a docker has a faulty environment and the idea here is to let them specify a setting to exclude those envs from the list, they can remove what is not needed from container instead. Since there is no use for such envs.
10 remaining items
DonJayamanne commentedon Jun 25, 2024
Re-opening to discuss this again,
Given that we're hiding Python environments in Codespaces, I think its time to re-visit this.
Here's a sample
devcontainer.jsonfrom https://github.com/devcontainers/images/blob/main/src/universal/.devcontainer/devcontainer.jsonHaving such a setting will improve the perf on code spaces and will result in a unified way to exclude Python environments.
DonJayamanne commentedon Jun 25, 2024
My understanding is that this cannot be done, as some of the python envs are required by other tools (i.e. its a dependency).
E.g. python in
/usr/bin/python`` or/bin/pythonare generally meant for tools and not meant for users, and users are meant to use/usr/local/bin/python`,I.e. some Python envs cannot be removed from the container.
samruddhikhandale commentedon Jun 25, 2024
For Codespaces, the JupyerLab change is pretty help, see devcontainers/images#139. Being able to filter out unwanted Python versions for JupyterLab made sense as Python needs some special configuration to work with JupyterLab in a codespace; otherwise, it would fail. Hence, it made sense to filter out the non-working versions of Python. 👍
For the community, they might like and prefer it based on their own use cases. Therefore, adding a setting in the Python extension to hide certain Python environments would indeed be useful. This feature would streamline the user experience by simplifying the environment selection process, ensuring users work with the intended Python interpreter without confusion. It also aligns with the principle of reducing cognitive load on users, allowing them to focus on development rather than configuration.
Additionally, the assumption that some Python environments are meant to be hidden from the user seems correct, especially in the context of a development container setup. Development containers are often designed with a specific environment in mind, including a pre-selected set of tools and configurations. The presence of multiple environments could lead to confusion or misconfiguration by end-users, especially if those environments are internal or meant for specific tasks unrelated to the user’s workflow.
eleanorjboyd commentedon Dec 8, 2025
is this still an ask? what is the relationship with the python environments extension now that it handles environments?
karthiknadig commentedon Dec 9, 2025
This is still an ask, it could be something we can handle in the environments extension.