Can not find working Python 3.6+ interpreter because of missing python-venv

未关闭
#393 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
documentation

调研方向

首先检查 PlatformIO 的安装要求,以及运行 python3 -m venv ~/.platformio/penv 的虚拟环境设置;该 issue 未指定文档文件或测试。确认此 repository 是否应记录 Debian/Ubuntu 的 python3-venv 要求,或者安装程序错误是否应归属于其他位置。缺失的 venv 依赖项及由此产生的用户指导得到明确记录,或被转交给正确的组件,即视为完成。

由索引模型根据 Issue 内容生成。

描述

I hope you don't mind that I used AI for that.

This happens even when a fully valid Python 3.12 interpreter is present and works normally.
The actual underlying issue is that the system is missing the python3-venv package, which PlatformIO needs to create its internal virtual environment.
However, the error message does not indicate this, leading users to believe their Python path or version is invalid.

This results in unnecessary confusion (e.g., users thinking they need to install Python 3.6 or a different interpreter path).

🔁 Steps to Reproduce

Use a Linux machine (e.g., Ubuntu/Mint/Debian) with:

python3 installed

but without python3-venv

Connect to the machine using VS Code Remote SSH from a Windows host.

Install the PlatformIO extension in the remote environment.

When prompted for a Python path, provide /usr/bin/python3 (which is Python 3.12.3 or similar).

PlatformIO reports:

Can not find working Python 3.6+ interpreter

✔️ Expected Behavior

PlatformIO should:

Detect that Python 3.6+ exists and is valid.

If venv support is missing, show a clear, actionable message, such as:

“Python interpreter is valid, but Python’s ‘venv’ module is missing.
Please install python3-venv and retry.”

❌ Actual Behavior

PlatformIO incorrectly reports that the Python interpreter is invalid or unsupported.

Users believe they must install Python 3.6 or provide a different path.

The real issue (missing python3-venv) is not mentioned.

🧪 Environment

Remote OS: Linux (Ubuntu/Mint/Debian family)

Python: /usr/bin/python3 → Python 3.12.3

Missing package: python3-venv

VS Code Remote SSH from Windows

PlatformIO extension latest version

🔍 Diagnosis

The installer attempts to create a virtual environment with:

python3 -m venv ~/.platformio/penv

This fails silently when python3-venv is missing.

PlatformIO then falls back to a generic error about “Python 3.6+” instead of telling the user the real failure cause.

Once the user installs:

sudo apt install python3-venv

the installer works immediately, and /usr/bin/python3 is accepted without issues.

💡 Suggested Fixes
Option A (Preferred): Improve error message

Detect missing venv module and show:

“Python is installed, but the ‘venv’ module is missing.
Please install python3-venv.”

Option B: Pre-check for venv

Before attempting venv creation, run:

import venv

If it fails, show a clear diagnostic.

Option C: Add documentation note

Add to installation requirements:

“Debian/Ubuntu users must install python3-venv to allow PlatformIO to create a virtual environment.”

主要语言
Python
星标
288
派生
361
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

platformio/platformio-docs 的其他 Issue

查看 platformio/platformio-docs 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。