'Conda environment not showing up in VS Code

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?



Solution 1:[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:[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:[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:[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:[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.

Solution 6:[6]

The extension automatically looks for interpreters in the following locations:

Conda environments that contain a Python interpreter. VS Code does not show conda environments that don't contain an interpreter.

After you create a conda environment, you need to activate it and install some packages in order to get the python interpreter. And remember to reload the VSCode. If it still does not exist, you can try to choose Enter interpreter path, to point the path manually.

Solution 7:[7]

In your project .vscode/settings.json file, just replace the old python.pythonPath setting with the new one (or add if non-existing) python.defaultInterpreterPath and it will work. The value for the setting is the path to the venv you're using in your project.

Afterward, Ctrl+Shift+P via Python: Select Interpreter will allow you to choose a different interpreter.

Solution 8:[8]

I had the same problem. After I opened Anaconda Prompt as Administrator and created the environment, I saw it in VS code

Open “Anaconda Prompt” from the Windows start button as “Administrator.”

Solution 9:[9]

For me installing pip fixes the issue.

conda install pip

Solution 10:[10]

The reason why vscode doesn't show the environment is that it doesn't have a python interpreter in it because of inheriting or something.

The solution is also simple. Just manually install python in that environment.

conda install python

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Horla.li
Solution 3 Rheatey Bash
Solution 4 derivmug
Solution 5 igorkf
Solution 6
Solution 7
Solution 8 EngAAA
Solution 9 OanaB
Solution 10 Hanx