Conda environment not showing up in VS Code

12,484

Solution 1

You can try to follow methods from vscode - Create a conda environment

Additional notes: ...To ensure the environment is set up well from a shell perspective, one option is to use an Anaconda prompt with the activated environment to launch VS Code using the code . command. At that point you just need to select the interpreter using the Command Palette or by clicking on the status bar.

Solution 2

in vscode press ctrl+shift+p and type python:Select Interpreter you should see all the environment there. If it does not appear create a .py file and try again. also you can press the reload icon on the search bar where you typed python:select interpreter.

Solution 3

Firstly you need to create an environment with python in it otherwise it won't recognize it. Create an environment like this first

conda create --name tf26 python==3.10

Use your preferred name and python version here thereafter restart VS Code. You will definitely see your env.

Note: You can delete any unused env if want like this

conda env remove --name <env_name>

Solution 4

I wanted to use the new environment as a Jupyter kernel and had to install the jupyter package for it to show up in the kernel selection of VSCode. You can install it by running conda install jupyter.

Solution 5

I finally resolved the problem.
This thread says that you need to create the conda environment passing the python argument:

conda create -n your_env_name python=3.7

Doing this the environment appears in the Select interpreter to start Jupyter server options.

Share:
12,484
TityBoi
Author by

TityBoi

Updated on June 16, 2022

Comments

  • TityBoi
    TityBoi almost 2 years

    I installed miniconda on Windows 10 and created an environment (I followed this guide: https://www.notion.so/shashankkalanithi/Setting-Up-Conda-Environment-ba83f7f019ea44b9af37588eed419eb9). However when I open the VS Code I don't see that environment python interpeter on kernel list. There is only one interpreter on the list: ~\Miniconda3\python.exe

    How can I fix this?

    • It_is_Chris
      It_is_Chris over 2 years
      Manually set the python interpreter: VS Code Documentation
    • merv
      merv over 2 years
      Is there not a canonical answer for this? I feel like I see this asked all the time, but I don't use VSC, so it's not something I keep tabs on. Someone please ping me if you have a duplicate to recommend.
  • TityBoi
    TityBoi over 2 years
    That's my issue. I don't see the environment after selecting python:Select Interpreter. I doesn't appear after I create .py file either.
  • Inyoung Kim 김인영
    Inyoung Kim 김인영 over 2 years
    This did update my conda env list. Though after I opend code by clicking icon, it was back to the problematic state. The envs are corretly shown in python venv manager extension, but not in select interpreter menu. To be exact, just after they show up, they are gone. I could just see a blink of them
  • seveneights
    seveneights over 2 years
    I had the same issue @TityBoi, all my conda envs were showing up, just one did not. Restarting VSCode multiple times did the trick at some point though.
  • Haasip Satang
    Haasip Satang almost 2 years
    Yep, that does the trick. It's also stated here: code.visualstudio.com/docs/python/…. You need to specifiy the interpreter, otherwise the environment won't appear in the list.