How to use conda on azure when using the powershell task on "windows-latest" vm?

Viewed 159

I'm trying to use conda in azure pipelines on a windows vm. In this question the solution is to use eval $(conda shell.bash hook) which works for me on linux and macos but for obvious reasons fails on windows. What is the equivalent when using the powershell task under a windows vm?

I've tried

conda shell.powershell hook

and

call conda shell.powershell hook 

and

conda init powershell

but all of these fail with

No action taken.

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - cmd.exe
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

How can I get conda to work with powershell and windows vm?

The azure yaml that I'm using is:

      - powershell: |
          conda shell.powershell hook
          conda activate pyomexmeta
          cd $(INSTALL_DIRECTORY)
          python setup.py bdist_wheel
          $wheel = Get-ChildItem -LiteralPath . -Recurse -File |% FullName
          pip install $wheel
          ipython -c "import pyomexmeta;pyomexmeta.run_tests()"
0 Answers
Related