vscode-python: Poetry environments not showing in "Select Interpreter"
Type: Bug
Behaviour
Expected vs. Actual
When trying to select an interpreter for a project that is based on Poetry, I sometimes either don’t see the virtual environment at all in the list or VSCode doesn’t show any other Poetry environments to select from. I would expect it to be able to list out all of the various Poetry environments that are on my machine and let me select one of them.
These projects are installed using the latest version of Poetry (1.2)
Steps to reproduce:
- Clone a bunch of Poetry projects and install their dependencies so that they are available to VSCode. Make sure you’re installing it to the default location, AFAIK on that Mac that is
~/Library/Caches/pypoetry/virtualenvs
- Run the “Select Interpreter” command.
- Note how there are not as many Poetry environments as there should be (if at all)
Here’s an interpreter list for a project that I’ve installed deps with Poetry (this is the full list it shows):

Here’s one for a project that uses Poetry - but notice that it doesn’t list any other Poetry environments (just its own - again, this is the full list it shows):

I almost entirely work with just Poetry projects, so there should be at least something like 7 or 8 environments for Poetry listed there, but they are not.
Please let me know if you have any questions regarding the above.
Diagnostic data
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.7
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Pyenv (this is Pyenv because I can’t select a Poetry environment for this project that I am in!)
- Value of the
python.languageServer
setting: Pylance
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
LSP Notebooks experiment is enabled
LSP Notebooks interactive window support is enabled
> conda info --json
Python interpreter path: ~/.pyenv/versions/3.10.7/bin/python
> ~/.conda/bin/conda info --json
> ~/.miniconda3/bin/conda info --json
> ~/.pyenv/versions/3.10.1/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.local/pipx/venvs/copier/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.10.2/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.10.5/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.10.6/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.10.7/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.8.10/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.8.13/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.9.10/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.9.14/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.10.7/bin/python3.10 ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> /opt/homebrew/bin/python3 ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> /opt/homebrew/bin/python3.8 ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> /opt/homebrew/bin/python3.9 ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.miniconda3/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> ~/.miniconda3/envs/ldm/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/interpreterInfo.py
> . ~/.local/pipx/venvs/copier/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/printEnvVariables.py
> . ~/.local/pipx/venvs/copier/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/printEnvVariables.py
> . ~/.local/pipx/venvs/copier/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/printEnvVariables.py
> . ~/.local/pipx/venvs/copier/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/printEnvVariables.py
> . ~/.local/pipx/venvs/copier/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/printEnvVariables.py
Starting Pylance language server.
> ~/.pyenv/versions/3.10.7/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/linter.py -m pylint ./mongodb/pd/mongodb_pd.py
cwd: .
> ~/.pyenv/versions/3.10.7/bin/python ~/.vscode/extensions/ms-python.python-2022.16.1/pythonFiles/linter.py -m pydocstyle --convention=google ./mongodb/pd/mongodb_pd.py
cwd: .
> ~/.pyenv/versions/3.10.7/bin/python -c "import pydocstyle"
> ~/.pyenv/versions/3.10.7/bin/python -c "import pylint"
> ~/.pyenv/versions/3.10.7/bin/python -c "import pydocstyle"
> ~/.pyenv/versions/3.10.7/bin/python -c "import pylint"
Linter 'pydocstyle' is not installed. Please install it or select another linter".
Error: Module 'pydocstyle' not installed.
Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.
User Settings
poetryPath: "<placeholder>"
languageServer: "Pylance"
linting
• pydocstyleArgs: "<placeholder>"
• pydocstyleEnabled: true
formatting
• provider: "black"
Extension version: 2022.16.1 VS Code version: Code 1.72.2 (d045a5eda657f4d7b676dedbfa7aab8207f8a075, 2022-10-12T22:15:55.763Z) OS version: Darwin arm64 21.6.0 Modes: Sandboxed: No
System Info
Item | Value |
---|---|
CPUs | Apple M1 Pro (10 x 24) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
Load (avg) | 21, 25, 23 |
Memory (System) | 32.00GB (1.68GB free) |
Process Argv | . --crash-reporter-id 07e484e5-ada3-4296-adea-39d6c26a0c7c |
Screen Reader | no |
VM | 0% |
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 15
I can reproduce the issue, thanks. Fix should be out in the pre-release version of the extension in a day, use the following to try it out:
Just confirming that 2022.14.0 resolves the problem, so I’ll use that until this issue is fixed.
I try previous versions, until v2022.14.0, this version can find poetry environment. I have collected logs on this version, hope it helps. log3.txt