vscode-python: python.pythonPath doesn't work properly in workspace with multiple python projects
Environment data
VS Code version: 1.19.3 Python Extension version: 2018.1.0 Python Version: 3.6.4 OS and version: Ubuntu 16.04
Actual behavior
In a workspace with multiple projects associated to multiple virtual environments, the association with virtual environments doesn’t work anymore. VSCode Python keep using the virtual environment defined in the first project of the workspace. If I open the single projects, the association with virtual environment works as expected.
Expected behavior
Correct association to a proper virtual environment for every project in a workspace.
Steps to reproduce:
- Add at least two projects in a workspace
- Configure a different virtual environment for every project using python.pythonPath
- Save the workspace
- Reload the window and check the virtual environment loaded by VSCode for each project
Logs
Output from Python
output panel
Output from Console window
(Help->Developer Tools menu)
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:249 [Extension Host] Python Extension: Failed to get conda info from conda null
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:249
/usr/share/code/resources/app/out/vs/workbench/workbench.main.js:249 [Extension Host] (node:26467) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
t.log @ /usr/share/code/resources/app/out/vs/workbench/workbench.main.js:249
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 28
Commits related to this issue
- Incorrect interpreter displayed in status bar in with multiple workspace folders (#785) Fixes #690 — committed to microsoft/vscode-python by deleted user 6 years ago
- Ensure display name is set in statusbar for environments not detected (#791) if environment is a virtual env then suffix with envname Fixes #690 — committed to microsoft/vscode-python by deleted user 6 years ago
- :white_check_mark: tests to ensure resource is passed into module installer (#855) Fixes #690 — committed to microsoft/vscode-python by deleted user 6 years ago
@DonJayamanne I’ve seen the same problem here, in my env. I’ll try to clarify @pferretti explanation for you through a simple example:
settings.json from project_1
settings.json from project_2
main.py from project_1
main.py from project_2
Folder contents:
6 - Open the
project_1/main.py
file and check the python path in the botton of the screen. You must just stay with the mouse pointer on it and a pop-up will open telling you the python path:As you can see above, it points to the python interpreter installed on
project_1
folder. This is fine.7 - Now open the
project_2/main.py
and make the same steps above:See that the python interpreter used by this folder is the same as project_1, instead of project_2. Even if I try to click on that menu and try to change the python interpreter of project_2 folder, it not works, because the menu always point to project_1 folder. Check the bellow prints:
I hope that I was clear enough.
@lig @galindro @jkehler @Tantalus13A98B5F The issue has been fixed and the fix will be delivered along with the next version (end of the month). For the moment, please feel free to download the latest Insiders Build of the extension (its contains all fixes and current dev work to be released in the next version).
@lig I believe I know what’s happened, our CI tests are failing hence the extension isn’t getting built. Please test this build of the extension.
Please download this extension python-2018.2.0-beta.zip
Rename the file extension from
.zip
to.vsix
Apologies for this issue. Hopefully we’ll have the CI tests resolved tomorrow (we’ve already got a PR lined up to resolve that)
Same here. Reproduces in 1.20. Makes vscode python extension almost unusable and results in false errors from all over the workspace. I had 9 folders in the same workspace and now I’m forced to remove and readd folders continuously to be able to use the extension.
Thanks @galindro , a perfect explanation 😃