posit-dev / posit-dev/positron

Positron reports the wrong Python version if you change the version used in a project

Open
#4,556 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: kernels bug lang: python
Dominant language
TypeScript
Stars
4.3k
Forks
184
Avg merge
1d 9h
Merged PRs (30d)
195

Description

System details:

Positron and OS details:

Positron Version: 2024.08.0 (Universal) build 48
Code - OSS Version: 1.91.0
Commit: ed616b36655fb24d116108bdd833f1321704315b
Date: 2024-08-19T04:26:51.868Z
Electron: 29.4.0
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

Interpreter details:

Python

Describe the issue:

I frequently switch between Python versions in testing and development work in the same project. Positron remembers the Python version from the virtual env from first use, even after if I destroy and recreate the venv and restart the interpreter.

Here's a screen recording of the steps mentioned below.

https://github.com/user-attachments/assets/61429f08-aabf-4413-980e-d9e3da63c939

Steps to reproduce the issue:

  1. Create a virtual environment for a Python version, e.g. 3.12, in a new project.
  2. Start the Python interpreter in Positron.
  3. Delete the .venv and create a new virtual env for a new Python version, e.g. 3.9.
  4. Restart the Python interpreter in Positron.
  5. On first launch it reports both 3.12 and 3.9; on restarts it reports having launched 3.12 (the original version).
uv venv -p 3.12
uv pip install ipykernel

# start Positron interpreter and check sys.version
# stop Positron interpreter

rm -rf .venv
uv venv -p 3.9
uv pip install ipykernel

# start Positron interpreter again and check sys.version

Expected or desired behavior:

Positron should report the actual python version in use in the virtual environmet.

Were there any error messages in the UI, Output panel, or Developer Tools console?

No.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the listed uv venv commands and inspect the Python interpreter startup and version-reporting flow. No file or test is named in the report, so locate the code handling interpreter identity across environment recreation. Done means Positron consistently reports the active virtual environment's Python version after restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.