Python¶
Python reaches all three products:
- Workbench runs it in Positron, VS Code, and Jupyter sessions
- Connect runs it for deployed content, and
- Package Manager serves PyPI and internal Python packages
This page collects each product's Python settings in one place. R has the matching page and a table that lines up the R and Python terms.
flowchart LR
Src["PyPI, Git"] --> PPM("Package<br/>Manager")
PPM -->|"serves packages"| WB("Workbench<br/>sessions")
PPM -->|"serves packages"| Con("Connect<br/>content")
WB -->|"runs Python from"| Py[("<code>/opt/python</code>")]
Con -->|"runs Python from"| Py
style WB fill:#e8f1f8,stroke:#447099,stroke-width:2px,color:#1a1a1a
style Con fill:#fdf1e3,stroke:#c9822b,stroke-width:2px,color:#1a1a1a
style PPM fill:#e8f5ec,stroke:#3f8f5a,stroke-width:2px,color:#1a1a1a
Installing Python¶
Install Python with uv into /opt/python/<version>, one directory per version; Posit no longer builds its own Python binaries.1 Workbench recommends installing Python under /opt, and Connect's starter configuration scans /opt/python.23
Workbench¶
Positron and VS Code sessions discover the interpreters under /opt/python, and JupyterLab sessions use the Python environments registered as Jupyter kernels.245 Users create virtual environments in their home directories, and pip --user installs land there too, so plan home directory space for both. See Home directories and storage.
Set the package index for every session in /etc/pip.conf:6
Connect¶
Connect has no built in scan path for Python. Python.ExecutableVersionScanning must list a directory, and the starter configuration installed with Connect sets it to /opt/python. List interpreters with Python.Executable, one entry per installation, and set Python.VersionMatching for content that must run on an exact version.37
The block below enables Python and lists one interpreter.
At deployment, Connect reads the Python version and requirements.txt from the bundle's manifest and installs the packages. It keeps the environments under python-environments/ in the data directory, where content may share them.8 Package installation always runs as the Applications.RunAs account.9
See Connect.
Package Manager¶
Package Manager serves PyPI and internal Python packages built from Git or uploaded as wheels and source distributions. Clients use the repository's simple index (for example, https://packagemanager.example.com/pypi/latest/simple). Replacing latest with a date freezes the index at that day.10 Server.PythonVersion is only used to build Git and local packages.11
See Internal packages and Change control.