6

I have been stuck on this issue for several days, so any help is greatly appreciated.

I recently had to move away from Anaconda (due to their change in the commercial policy) and decided to try Miniforge. It comes with Python 3.9, but since in most projects I need 3.7, I created a new venv with conda create --name StandardPython python=3.7.6.

Each time I open a python script I get the error message "Python is not installed":

enter image description here

even though it of course is, and I can even manually select the interpreter:

enter image description here

Moreover, the virtualenv I have created is not found in the list given by VScode:

enter image description here

I can select it manually with "Enter the interpeter path", but besides that being a long process to do each time I want to switch envs, it also does not fix the problem as at the next restart VScode still does not show the venv in the list, even though it is indicated as "current":

enter image description here

It's worth mentioning that I am not using workspaces at the moment, I am just opening the python file(s) directly. This worked perfectly with Anaconda and I could select all the venvs I created without problems from the list, so switching was a breeze. Somehow now it does not work anymore.

I have already tried:

  • Removing (conda env remove --name StandardPython) and recreating the environment
  • Setting the python:pythonpath in VScode to the base python ....\AppData\Local\miniforge3\python.exe
  • Setting the python:condapath to Miniforge's path ....\AppData\Local\miniforge3\Scripts\conda.exe
  • Uninstalling and reinstalling the Python plugin for VScode
  • Uninstalling and reinstalling VScode (also manually cleaning up all configs and plugin files
  • Uninstalling and reinstalling Miniforge
F. Remonato
  • 248
  • 2
  • 12

1 Answers1

1

Ugh, a similar thing happened to me!

VS Code runs a series of commands to determine what interpreters it populates in that list when you attempt to set the python interpreter for your project. One of those commands it runs is conda env list. So then that is first thing you should check: run conda env list at your default terminal outside of VS Code.

Next, what terminal is that you are using? bash? zsh? Whatever terminal you are using outside of VS Code, (which you used for installing and configuring conda for instance) ensure that you set it to be the default terminal in VSCode. The root cause for this behavior is discussed here miniforge & vscode terminal needs to be set.

Finally restart VSCode and try to set the interpreter and see if your miniforge conda environments show up in the list. This worked for me as you can see in the screenshot.

enter image description here

Hope this helps!

Joseph
  • 131
  • 1
  • 6
  • The [link](https://github.com/conda-forge/miniforge/issues/249) shared about the root cause solved the issue – Onen simon May 26 '23 at 19:49