You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto activation of environments does not work with multi root workspaces #3325
I have a very similar issue with a multi-root workspace containing two folders. Each of the folders has it's own venv. But for both folders only the venv which is set for the first folder starts in the terminal.
I also found, if I change the positions of the folder path within the <multiroot-workspacename>.code-workspace file, always the venv of the first folder is started.
This example would start the venv1 of myfolder1 which is set in it's .vscode/settings.json with "python.pythonPath": "venv1/bin/python", even if I run a file from myfolder2. By the way, the default setting "python.terminal.activateEnvironment": true is active.
If I change my <multiroot-workspacename>.code-workspace file to the following, everything is run with the venv2 of myfolder2 instead.
Yeah, I have the same issue whenever I have a workspace with several virtualenv, even if I specify path folders in the settings.json, VSCode will always activate the first one in the terminal. A temporary workaround I found is having only one python/venv per workspace, and using the Project Manager to switch between projects.
Hi Helge Drews (@dahelg) and Jordan Kowal (@Jordan-Kowal) 👋 would you mind trying the latest Insiders version of the extension (2019.10.0.38992-dev and onwards) ? #7534 just got merged (for issue #6282) and may help with environment activation for multi-root workspaces.
I think this issue maybe fixed. I tried creating the terminal in multiworkspace scenario, and it asks me this before creating the terminal. It then correctly activates the correct environment based on that.
I'm on latest insider and extension as well, & it doesn't work for me.
Please ensure you close all files when opening a terminal (there's no mention of having files opened here).
Don Jayamanne (@DonJayamanne)Kartik Raj (@karrtikr)
I am not sure if this is a separate issue, but there sure are some similarity: I have one VSC workspace with multiple folders. There is no settings.json or .vscode folder(s), just a single .code-workspace file with all settings, launch and other workspace settings. Here is my folder structure:
folder1/:
<package 1>/
wks/:
dev.code-workspace
venv/
folder2/:
<package 2>/
folder3/:
<package 3>/
...
I want to use venv from folder1 in all folders/packages added to dev.code-workspace, so I set workspace-wide python interpretter setting to python in venv. As it currently works, venv is detected, selected and activated properly for folder1, but not for others. Others report missing python interpretter path setting and therefore also doesn't work.
Am I doing something wrong or is this a bug?
ping <someone>
I am wondering if there is any clarification on this subject? I am really starting to wonder I am doing something wrong since no other is reporting/thumbing up this issue.
Activity
dahelg commentedon Jun 20, 2019
I have a very similar issue with a multi-root workspace containing two folders. Each of the folders has it's own venv. But for both folders only the venv which is set for the first folder starts in the terminal.
I also found, if I change the positions of the folder path within the
<multiroot-workspacename>.code-workspacefile, always the venv of the first folder is started.{ "folders": [ { "path": "myfolder1" }, { "path": "myfolder2" } ] }This example would start the venv1 of myfolder1 which is set in it's
.vscode/settings.jsonwith"python.pythonPath": "venv1/bin/python", even if I run a file from myfolder2. By the way, the default setting"python.terminal.activateEnvironment": trueis active.If I change my
<multiroot-workspacename>.code-workspacefile to the following, everything is run with the venv2 of myfolder2 instead.{ "folders": [ { "path": "myfolder2" }, { "path": "myfolder1" } ] }Jordan-Kowal commentedon Jun 20, 2019
Yeah, I have the same issue whenever I have a workspace with several virtualenv, even if I specify path folders in the settings.json, VSCode will always activate the first one in the terminal. A temporary workaround I found is having only one python/venv per workspace, and using the Project Manager to switch between projects.
kimadeline commentedon Sep 28, 2019
Hi Helge Drews (@dahelg) and Jordan Kowal (@Jordan-Kowal) 👋 would you mind trying the latest Insiders version of the extension (
2019.10.0.38992-devand onwards) ? #7534 just got merged (for issue #6282) and may help with environment activation for multi-root workspaces.Thanks!
karrtikr commentedon Nov 26, 2019
I think this issue maybe fixed. I tried creating the terminal in multiworkspace scenario, and it asks me this before creating the terminal. It then correctly activates the correct environment based on that.
DonJayamanne commentedon Nov 26, 2019
Create a terminal by clicking on
+on the terminal window (i.e. do not use out command).karrtikr commentedon Nov 26, 2019
That's what I did. But I don't see this issue.
DonJayamanne commentedon Nov 26, 2019
Ok, not sure how it works for you.
This is what i did:
helloAhelloBhelloAas the interpreter for foldera, similarlyhelloBforb.a, thenhelloAshould be activated in terminalb, thenhelloBshould be activated in terminalkarrtikr commentedon Nov 26, 2019
Yes, I did exactly the same thing. I am using the latest VS Code insiders and extension version. Asking Kim-Adeline Miguel (@kimadeline) to repro it.
DonJayamanne commentedon Nov 26, 2019
I'm on latest insider and extension as well, & it doesn't work for me.
Please ensure you close all files when opening a terminal (there's no mention of having files opened here).
karrtikr commentedon Nov 26, 2019
Oh right, I had files opened in the tab. I closed all the tabs and I am able to repro this. Sorry for the confusion.
schperplata commentedon Jan 4, 2021
Don Jayamanne (@DonJayamanne) Kartik Raj (@karrtikr)
I am not sure if this is a separate issue, but there sure are some similarity: I have one VSC workspace with multiple folders. There is no
settings.jsonor.vscodefolder(s), just a single.code-workspacefile with allsettings,launchand other workspace settings. Here is my folder structure:...
I want to use
venvfromfolder1in all folders/packages added todev.code-workspace, so I set workspace-wide python interpretter setting to python invenv. As it currently works,venvis detected, selected and activated properly forfolder1, but not for others. Others report missing python interpretter path setting and therefore also doesn't work.Am I doing something wrong or is this a bug?
schperplata commentedon Mar 9, 2021
ping <someone>I am wondering if there is any clarification on this subject? I am really starting to wonder I am doing something wrong since no other is reporting/thumbing up this issue.
karrtikr commentedon Mar 9, 2021
Please open up a new issue with the details and we can help you. We don't track new issues in comments.
karrtikr commentedon Oct 20, 2021
Closed as dup of #15522