question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poetry environments not showing in "Select Interpreter"

See original GitHub issue

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:

  1. 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
  2. Run the “Select Interpreter” command.
  3. 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):

CleanShot 2022-10-26 at 13 04 55@2x

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):

CleanShot 2022-10-26 at 13 15 21@2x

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 (ViewOutput, 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%

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:15

github_iconTop GitHub Comments

1reaction
karrtikrcommented, Nov 8, 2022

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:

image

1reaction
macintacoscommented, Nov 1, 2022

Just confirming that 2022.14.0 resolves the problem, so I’ll use that until this issue is fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode doesn't show poetry virtualenvs in select interpreter ...
I was able to select my Poetry virtual environment for my interpreter/ipynb kernel again after changing the dated python.
Read more >
Poetry Environment neither automatically detected nor shown ...
The interpreter isn't shown in t he dropdown when I use the "Select Interpreter" command. Steps to reproduce: [NOTE: Self-contained, minimal ...
Read more >
Managing environments | Documentation - Poetry
To achieve this, it will first check if it's currently running inside a virtual environment. If it is, it will use it directly...
Read more >
Configure a Poetry environment | PyCharm Documentation
Press Ctrl+Alt+S to open Settings/Preferences and go to Project: <project name> | Python Interpreter. Click the Add Interpreter link next to the ...
Read more >
Using Python environments in VS Code
The selected interpreter version will show on the right side of the Status Bar. Status Bar showing a selected interpreter. The Status Bar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found