Skip to content

Commit 900b5ca

Browse files
new page about Python interpreters (#99)
* new page about Python interpreters * feedback * missed a couple things
1 parent c8e2b66 commit 900b5ca

File tree

4 files changed

+124
-3
lines changed

4 files changed

+124
-3
lines changed

_quarto.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ website:
6363
contents:
6464
- managing-interpreters.qmd
6565
- interpreter-startup.qmd
66+
- python-installations.qmd
6667
- r-installations.qmd
6768
- keyboard-shortcuts.qmd
6869
- data-explorer.qmd
@@ -84,7 +85,7 @@ website:
8485
- feedback.qmd
8586
- faqs.qmd
8687
- privacy.qmd
87-
88+
8889
format:
8990
html:
9091
css: styles.css

interpreter-startup.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ When Positron starts for the first time in a new workspace, it will start a Pyth
88

99
Typically when starting Python or R without other clues about which version to start, Positron will start the most recent version of the interpreter (e.g. if you have R 4.2 and R 4.3 installed, it'll start R 4.3).
1010

11-
If you are an R user, see the [R discovery](r-installations.qmd) guide for more information on available installations.
11+
See the [Python discovery](python-installations.qmd) and [R discovery](r-installations.qmd) guides for more information on language-specific installations.
1212

1313
### RStudio detection
1414

python-installations.qmd

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
title: "Discovering Python Installations"
3+
---
4+
5+
This guide explains how Python installations are discovered and managed in Positron.
6+
7+
## Python installation discovery
8+
9+
Positron uses multiple strategies to discover Python interpreters and virtual environments across your system.
10+
The discovery process includes both global Python installations and various virtual environment managers.
11+
12+
### Supported environment managers
13+
14+
Positron supports the following Python environment managers:
15+
16+
* **venv**: Standard library virtual environments created with `python -m venv`
17+
* **uv**: Virtual environments and Python installations managed by `uv`
18+
* **pyenv**: Python installations managed by `pyenv`, including virtual environments
19+
* **conda**: Conda environments created with `conda create` or `mamba create`
20+
21+
Other tools may also be compatible, although they are not officially supported at this time.
22+
23+
### Discovery locations
24+
25+
Positron searches for Python interpreters in the following locations:
26+
27+
**Virtual environments**
28+
29+
* `.venv/` and `.conda/` folders in your [workspace](https://code.visualstudio.com/docs/editing/workspaces/workspaces#_singlefolder-workspaces) directory
30+
* Tool-managed project-specific installations in locations like `~/.local/share/virtualenvs` or where `conda` stores envs
31+
32+
**Global Python installations**
33+
34+
* System Python installations in standard locations like the user's `PATH`
35+
* `/opt/python`
36+
* Tool-managed installation locations like `~/.pyenv` or ` ~/.local/share/uv/python/`
37+
38+
Note that using a system Python installation in a new session can lead to problems (see the official [guidance](https://packaging.python.org/en/latest/specifications/externally-managed-environments/) about this).
39+
For that reason, we recommend using virtual environments.
40+
41+
**Custom locations**
42+
43+
* Interpreters listed in the [`python.interpreters.[include,exclude,override]` settings](positron://settings/python.interpreters.include) (see [Related Settings](#related-settings) below for details)
44+
45+
## Environment creation and discovery
46+
47+
### Creating new environments
48+
49+
You can create new Python environments directly from Positron using the _Python: Create Environment_ command:
50+
51+
1. Open the Command Palette (<kbd>Cmd/Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
52+
2. Select _Python: Create Environment_
53+
3. Choose from available environment providers:
54+
- **uv**: Creates a uv-managed virtual environment (if uv is available)
55+
- **venv**: Creates a standard virtual environment using `python -m venv`
56+
- **conda**: Creates a conda environment (if conda is available)
57+
58+
The environment will be created in your workspace and automatically discovered.
59+
60+
You can also use the **New Folder From Template** feature to create a new Python project, and set up an environment as part of the project.
61+
62+
### Discovering existing environments
63+
64+
Positron automatically discovers environments when:
65+
66+
- You open Positron
67+
- You open a new workspace folder
68+
- Certain file system changes are detected in watched directories
69+
- You manually refresh using the _Interpreter: Discover All Interpreters_ command
70+
71+
The discovery process runs in the background and updates the interpreter list as new environments are found.
72+
73+
## Discovery process details
74+
75+
### Unsupported Python versions
76+
77+
Positron only supports Python minor versions 3.9 through 3.13, which are the [currently supported versions](https://devguide.python.org/versions/).
78+
Other versions may be discovered, but you may run into issues using them.
79+
80+
### Locator type
81+
82+
Positron can use two different discovery mechanisms:
83+
84+
* **JavaScript locator** (default): Pure TypeScript implementation for more comprehensive discovery
85+
* **Native locator** (experimental): Uses a native binary for faster discovery
86+
87+
You can control this with the [`python.locator` setting](positron://settings/python.locator) (`"js"` or `"native"`).
88+
Keep in mind that the `native` locator is experimental and may not work completely as intended.
89+
90+
## Troubleshooting
91+
92+
### Environment not appearing
93+
94+
If the above settings are configured correctly, and the Python version is supported, and _Interpreter: Discover All Interpreters_ or a restart of Positron is not helping, you can check logs. See more in the [troubleshooting guide](troubleshooting.qmd).
95+
96+
For the `js` (default) locator, the discovery process is logged in the Python Language Pack channel of the Output panel.
97+
98+
For the `native` locator, it is instead logged in the Python Locator channel.
99+
100+
## Related settings
101+
102+
Key settings that control Python environment discovery:
103+
104+
### Discovery location settings
105+
* [`python.interpreters.include`](positron://settings/python.interpreters.include): Specific interpreter paths to include
106+
* [`python.interpreters.exclude`](positron://settings/python.interpreters.exclude): Interpreter paths to exclude from discovery
107+
* [`python.interpreters.override`](positron://settings/python.interpreters.override): Override the above two settings so only these are shown
108+
109+
### Environment providers
110+
* [`python.environmentProviders.enable`](positron://settings/python.environmentProviders.enable): Enable/disable specific environment providers for environment creation (`Venv`, `Conda`, `uv`)
111+
112+
### Discovery behavior
113+
* [`python.locator`](positron://settings/python.locator): Choose between "native" or "js" discovery methods
114+
* [`python.defaultInterpreterPath`](positron://settings/python.defaultInterpreterPath): Default Python interpreter path (used only the first time when no other interpreter takes precedence)
115+
116+
## Related commands
117+
118+
* _Interpreter: Discover All Interpreters_: Find new interpreters
119+
* _Interpreter: Select Interpreter Session_: Select an interpreter for a session
120+
* _Python: Create Environment_: Create a new virtual environment

r-installations.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Discovering R Installations"
33
---
44

5-
This guide pertains to how R installations are discoverd and show up in the Interpreter picker.
5+
This guide pertains to how R installations are discovered and show up in the Interpreter picker.
66

77
## R installation discovery
88

0 commit comments

Comments
 (0)