-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poetry Environment neither automatically detected nor shown in "Select Interpreter" list #16232
Comments
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can. |
I've worked around this for the time being by just setting Poetry to create virtual environments in the project. But I believe the point of #8372 was to make it so that this was not required. |
Yes, this seems unexpected. Can you do the following:
LogsOutput for
|
I wanted to comment to say that I am having the exact same issue. Setting python.venvPath does nothing. I have tried using both the default directory where poetry stores venvs as well as placing it in the project directory. I cannot type in the path either and have it change. It's as if it does not exist for VSCode. I would be fine if I could get this to work manually! |
I'm hitting the same issue, here are the logs that I think show what's happening
I see |
Yep vscode-python/src/client/pythonEnvironments/common/posixUtils.ts Lines 118 to 137 in 31c41e0
|
@karrtikr apologies for the delay. Here's the info-level logs from a fresh session: https://gist.github.com/macintacos/263ecdf3eb5f1d6495f5353417261e0d |
Is it due to macOS pypoetry sometimes symlinking the python interpreter binary? I notice on Windows that's not the case |
@macintacos how do you set pypoetry to create venvs in workspace? |
I also encountered this phenomenon, but it has been resolved. In my case, it was because I upgraded Python from 3.8 to 3.9 after building the .venv and removed the old version. Maybe it wasn't a good idea to delete it. To solve this, simply delete the Just in case, I would like to write about my environment. os: Windows 10.0.19042 .venv is set to be created in the project. I don't know if the cause is the same for everyone, but I hope this helps. |
@fuji44 unfortunately, deleting/reinstalling, upgrading Python, etc. has not resolved the situation for me. @jleaders as @fuji44 mentioned at the end there, you can run |
@macintacos Thanks for reading. I expect that the cause was that I created .venv with Python 3.8 and then deleted Python 3.8. As a solution, I ran |
@fuji44 okay - just to clarify, the issue I'm bringing up is not about virtual environments that are being creating in the local project (those work fine), this is strictly about virtual environments that are being created by Poetry in the "default" location, meaning environments that are created when |
I'm running the command mentioned above. I am not getting any errors, however the venv folder hasn't been created. |
It's a configuration setting. You have to remove your old environment and then |
@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,
If it doesn't please provide a fresh set of logs and provide the output for |
Thanks @karrtikr - I'll try that out, however I wasn't under the impression that this was an "experimental" feature, I thought it was just a new feature added to the extension (everything I was reading didn't mention this option as being required to get Poetry to work). I'll let you know if that gives me any success though. |
Yep, we launched this as an experiment feature but all users should now be opted in, not sure why you were not. (there's an opt out setting maybe you have that in your User settings) |
Sorry for the delay @karrtikr, but I just tested that out and it works, thanks! For those who happen upon this, you need to remove your old environment, Closing this out, thanks! |
Thanks for your work on that! @karrtikr |
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
:List of interpreters to choose from:
Environment data
python.languageServer
setting: PylanceExpected 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]
The text was updated successfully, but these errors were encountered: