python.pythonPath doesn't work properly in workspace with multiple python projects
See original GitHub issueEnvironment 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:28
Top Results From Across the Web
Opening a Workspace causes python.pythonPath to be ignored
VS Code refuses to use the custom python.pythonPath I have specified in settings.json to run Python files through Microsoft's Python Extension.
Read more >Using Python environments in VS Code
Configuring Python Environments in Visual Studio Code. ... Note: While it's possible to open a virtual environment folder as a workspace, doing so...
Read more >How to Configure Eclipse for Python - Rose-Hulman
Enter http://pydev.org/updates in the Work with: field. After several seconds, two options should appear. Select the PyDev for Eclipse option. Do not select...
Read more >Open, reopen, and close projects | PyCharm Documentation
Once you have opened the project, you should configure Python interpreter for ... that is not currently available, PyCharm shows a warning and...
Read more >Efficient Way to Activate Conda in VSCode - Medium
If you have problem finding the conda virtual environment path, you can open a terminal with your target conda env activated, and then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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).