How to Get VS Code to Recognize Your Conda Environment

Harpreet Sahota
2 min readMar 15, 2023

Follow these simple steps

Photo by David Schultz on Unsplash

To get Visual Studio Code (VSCode) to recognize your Conda environment, you can follow these steps:

  1. Open VSCode and open the folder or workspace that you want to work with.
  2. Open the Command Palette by pressing “Ctrl + Shift + P” (Windows or Linux) or “Cmd + Shift + P” (Mac).
  3. Type “Python: Select Interpreter” in the Command Palette and select it.
  4. If you have installed Conda and created a Conda environment, you should see your Conda environment listed in the list of available interpreters. Select it and wait for VSCode to recognize it.
  5. Once VSCode recognizes your Conda environment, it will automatically activate it, and you should be able to use it in your Python code.

You may need to add manually if you do not see your Conda environment listed in the available interpreters.

To do this, you can follow these steps:

  1. Open the Command Palette by pressing “Ctrl + Shift + P” (Windows or Linux) or “Cmd + Shift + P” (Mac).
  2. Type “Python: Create Terminal” in the Command Palette and select it.
  3. In the terminal that opens up at the bottom of VSCode, type the following command and press enter:
  4. conda info --envs
  5. This will list all the Conda environments that you have created.
  6. Find the path to your Conda environment that you want to add and copy it to the clipboard.
  7. Open the Command Palette again, type “Python: Select Interpreter,” and select it.
  8. Click the “Enter interpreter path” option at the bottom in the list of available interpreters.
  9. Paste the path to your Conda environment that you copied earlier and press enter.
  10. VSCode should now recognize your Conda environment and activate it. You can verify this by looking at the bottom left corner of VSCode, where you should see the name of your Conda environment displayed.

--

--

Harpreet Sahota

🤖 Generative AI Hacker | 👨🏽‍💻 AI Engineer | Hacker-in- Residence at Voxel 51