The University of Kansas prohibits discrimination on the basis of race, color, ethnicity, religion, sex, national origin, age, ancestry, disability, status as a veteran, sexual orientation, marital status, parental status, gender identity, gender expression, and genetic information in the university's programs and activities. Retaliation is also prohibited by university policy. Request a proposal/quote for our seervices that cover website design, database development, internet community advertising and PC/Mac computer support. Macintosh and PC Computer Support Getting prompt, accurate and proactive PC/Mac support services are becoming more and more a challenge. Connect to any data source in batch or real-time, across any platform. Download Talend Open Studio today to start working with Hadoop and NoSQL. Read Customer Story ›. Data Model Design and Best Practices.
I have a Python project and navigation/autocomplete work perfectly within files in the project. I want to specify a virtualenv so that navigation/autocomplete work with packages inside that virtualenv.
I tried this in settings.py but navigation/autocomplete does not work. Also by setting 'python.pythonPath':'~/dev/venvs/proj/bin/python killed the original navigation/autocomplete.
12 Answers
With the latest update to the extension all you need to do is just specify the 'python.pythonPath' as follows.The values for 'python.autoComplete.extraPaths' will be determined during runtime, but you are still free to specify custom paths in there.
Please, remember to re-start VS Code once the necessary changes have been made.
nbroAla Read Design Studio For Mac V19
DonAs of September 2016 (according to the Github repo documentation of the extension) you can just execute a command from within vscode that will let you select the interpreter from an automatically generated list of known interpreters (including the one in your project's virtual enviroment).
How to use this feature?
Select the command
Python: Select Workspace Interpreter(*) from the command palette (F1).Upon selecting the above command a list of discovered interpreters will be displayed in a
quick picklist.Selecting an interpreter from this list will update the settings.json file automatically.
(*) This command has been updated to Python: Select Interpreter in the latest release of VSC (thanks @nngeek).
Also, notice that your selected interpreter it will be shown at the left side of the statusbar e.g. Python 3.6 64-bit. This is a button you can click to trigger the Select Interpreter feature.
Quite Simple with latest VSCode, if you have installed Official Python extension for VSCode
Shift + Command + P
Type : Python: Select Interpreter
Choose your virtual env.
With the latest Python extension for visual studio code, there is a venvPath Setting:
On Mac OS X, go to Code > Preferences > Settings and scroll down to Python Configuration.
Look for 'python.venvPath: ', and click the pencil on the left-hand side to open up your user settings. Finally, add the path to where you store your virtual environments.
If you are using virtuanenvwrapper, or you have put all your virtual env setting in one folder, this will be the one for you.
After you have configured 'python.venvPath', restart VSC. Then open the command palette and look for 'Python: Select Interpreter'. At this point, you should see the interpreter associated with the virtual environment you just added.

Another way is to open the VSC from a terminal with the virtualenv set and need to perform F1Python: Select Interpreter and select required virtualENV
Tentative answer. I put the absolute path of the virtual environment python executable as well has the packages. I then restarted VS code.
I am trying to get ${workspaceRoot} to avoid hardcoding absolute paths, please help if you have succeeded.
Jesvin JoseJesvin JoseI was able to use the workspace setting that other people on this page have been asking for.
In Preferences, ⌘+P, search for python.pythonPath in the search bar.
You should see something like:
Then click on the WORKSPACE SETTINGS tab on the right side of the window. This will make it so the setting is only applicable to the workspace you're in.
Afterwards, click on the pencil icon next to 'python.pythonPath'. This should copy the setting over the workspace settings.
Change the value to something like:
Stephen Raucha) Modify Visual Studio Code default virtual env path setting. It's called 'python.venvPath'. You do this by going into code->settings and scroll down for python settings.
b) Restart VS Code

c) Now if you do Shift + Command + P and type Python: Select Interpreteryou should see list of your virtual environments.
Seems to be (as by 2018.03) in code-insider, directive been introduced called python.venvFolders:
All you need is to add your virtualenv folder name.
holmsholmsOn Mac OSX using Code Version 1.34.0 (1.34.0) I had to do the following to get VSCode to recognise the virtual environments:

Location of my virtual environment (named ml_venv):
I added the following entry in Settings.json: 'python.venvPath': '/Users/auser/.pyvenv'
Restarted the IDE, and now I could see the interpreter from my virtual environment:
I'm running in Windows, and you can find the instruction at https://code.visualstudio.com/docs/python/environments Basically do this 'To select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).' Then type in Python: S and click select interpreter, then choose the venv you created.
Got this from Youtube Setting up Python VS... Venv
OK, the video really didn't help me all that much, but... the first comment under (by the person who posted the video) makes a lot of sense and is pure gold.
Ala Read Design Studio For Mac
Basically, open up VS' built-in Terminal. Then source <your path>/activate.sh, the usual way you choose a venv from the command line. I have a predefined bash function to find & launch the right script file and that worked just fine.
Ala Read Design Studio For Mac
Quoting that YT comment directly (all credit to aneuris ap):
(you really only need steps 5-7)
As you may notice, he's talking about activate.bat. So, if it works for me on a mac, and it works on Windows too, chances are it's pretty robust and portable. 😀