[Python] VSCode could not find conda environment: .conda

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    I recently installed Miniconda and VSCode, and I'm learning how to setup environments with Conda and wanting to program in VSCode. However, after I setup my environment, Conda can't find it when running my python script.

    My Setup


    I'm using:

    • Conda 25.7.0 (via Miniconda)
    • VSCode 1.103.2
    • Windows 11 Version 10.0.26100 Build 26100
    • Powershell as my terminal.

    In VSCode, I created a workspace folder C:\Users\[username]\vscode\other.

    I setup my virtual environment with the following steps:

    1. Search Python: Create Environment...
    2. Select Conda
    3. Select Python 3.11

    It takes a minute to create the environment, and then I see that the .conda folder appears in my workspace and my Python interpreter is selected to the correct Python (.\.conda\python.exe)

    This all seems great until I actually try to run my code.

    My Issue


    When I hit run, the terminal window opens and my (base) environment is initially activated. Then it tries to activate the new environment with this:

    conda activate .conda

    And that's where I get the following error:

    EnvironmentNameNotFound: Could not find conda environment: .conda
    You can list all discoverable environments with `conda info --envs`.


    So I list all my environments, and this is what I have:

    # conda environments:
    #
    base * C:\Users\[username]\miniconda3
    c:\Users\[username]\vscode\other\.conda


    So I obviously have my environment, but I suppose it won't activate it using relative path.

    How do I solve this so that I can have my Conda virtual environment in VSCode?

    Continue reading...

Compartilhe esta Página