Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda activate fails with CommandNotFoundError #167325

Closed
skwde opened this issue Nov 27, 2022 · 2 comments
Closed

conda activate fails with CommandNotFoundError #167325

skwde opened this issue Nov 27, 2022 · 2 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug confirmation-pending tasks Task system issues

Comments

@skwde
Copy link

skwde commented Nov 27, 2022

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.73.1 (commit: 6261075)
  • OS Version: macOS BigSur (11.7)

Steps to Reproduce: (I also asked this here: https://stackoverflow.com/questions/74569128/use-conda-envrionment-in-vscode-task, but I didn't got a reply)

  1. Install conda (https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html) and ensure that conda is in your PATH
  2. Create conda environment via conda env create -n mkdocs python=3 mkdocs-material; Ensure that you can activate the environment conda activate mkdcos
  3. Create following following tasks
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "conda info",
      "type": "shell",
      "command": "type conda; which conda",
    },
    {
      "label": "Activate conda envrionment: mkdocs",
      "type": "shell",
      "command": "conda",
      "args": [
        "activate", "mkdocs"
      ]
    },
    {
      "label": "Serve mkdocs",
      "type": "shell",
      "command": "mkdocs serve --strict --dev-addr localhost:8010",
    },
    {
      "label": "run mkdocs serve in environment",
      "group": "test",
      "presentation": {
        "reveal": "always",
        "panel": "shared"
      },
      "runOptions": { 
        "runOn": "folderOpen" 
      },
      "dependsOrder": "sequence",
      "dependsOn": [
        "conda info",
        "Activate conda envrionment: mkdocs", 
        "Serve mkdocs"
      ],
    }
  ]
}
  1. Run the task and see that it fails with

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

Note, I have "python.condaPath" set and conda info / which conda tasks shows the correct path. Moreover when I open a terminal in VScode I can just execute the command and it works.

@Tyriar Tyriar added the bug Issue identified by VS Code Team member as probable bug label Dec 5, 2022
@meganrogge
Copy link
Contributor

This is an environment issue bc tasks is likely running the rc file instead of the profile. I'd try adding conda to the path for both

@skwde
Copy link
Author

skwde commented Dec 14, 2022

I don't quite get why this is closed. How can it be an environment issue when conda can be used outside of tasks without an issue and which conda or conda info is showing the correct path when run as a task?

@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug confirmation-pending tasks Task system issues
Projects
None yet
Development

No branches or pull requests

3 participants