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 Environment neither automatically detected nor shown in "Select Interpreter" list

See original GitHub issue

As far as I can tell, Poetry support was added in the version of the Python extension that I have, however I’m unable to get it to detect is automatically by VSCode, and it doesn’t appear as an interpreter to select with the appropriate command. I know that I can specify the path for it to get the environment manually, but I feel like that defeats the purpose - I’d really like to get it properly set up in an automated fashion 🙂

Output of poetry env info:

Virtualenv
Python:         3.8.9
Implementation: CPython
Path:           /Users/juliant/Library/Caches/pypoetry/virtualenvs/mince-4ZV0U0mz-py3.8
Valid:          True

System
Platform: darwin
OS:       posix
Python:   /Users/juliant/.pyenv/versions/3.8.9

List of interpreters to choose from:

CleanShot Code 2021-05-13 at 00 57 22

Environment data

  • VS Code version: 1.56.1
  • Extension version (available under the Extensions sidebar): v2021.5.829140558
  • OS and version: macOS 11.2.3
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.9 (pyenv)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): Poetry
  • Relevant/affected Python packages and their versions: Poetry 1.1.6
  • Relevant/affected Python-related VS Code extensions and their verions: N/A? (version given above)
  • Value of the python.languageServer setting: Pylance

Expected behaviour

the Python extension automatically finds my Poetry environments and (at the very least) suggests it as an interpreter option

Actual behaviour

The interpreter isn’t shown in t he dropdown when I use the “Select Interpreter” command.

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Create a project using Poetry
  2. Install dependencies
  3. Try to select the environment that Poetry generates
  4. Be sad when it’s not in the list of interpreters to choose from

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:20

github_iconTop GitHub Comments

2reactions
karrtikrcommented, May 25, 2021

@macintacos It seems it’s because you’re not opted into discovery experiment which has the Poetry related functionality. Can you add the following to your User settings and see if it helps,

"python.experiments.optInto": ["pythonDiscoveryModuleWithoutWatcher"]

If it doesn’t please provide a fresh set of logs and provide the output for poetry env list command which we use to discover envs.

2reactions
karrtikrcommented, May 13, 2021

Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can.

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 >
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
Configuring Python Environments in Visual Studio Code. ... If one is found, then no other interpreters are searched for or listed as pipenv...
Read more >
Anthony Shaw в Twitter: „@followben another note on that GitHub ...
What about monorepos w/ multiple poetry envs in a single workspace ... Poetry Environment neither automatically detected nor shown in "Select Interpreter" ...
Read more >
Announcing Poetry 1.2.0 | Blog
Poetry automatically loads all plugins installed into its environment. While there are many methods to add plugins to a Python environment (or ......
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