mamba-org / setup-micromamba

GitHub Action to set up micromamba
MIT License
97 stars 15 forks source link

Fails on self-hosted runner when micromamba already exists #164

Closed artemisart closed 10 months ago

artemisart commented 11 months ago

Hello, I tried using this action on a self-hosted runner where I don't want to install+uninstall mamba on each run to save time, is this planned to be supported someday? (should just skip if the env already exists) Currently fails:

> Run mamba-org/setup-micromamba@v1
  with:
    environment-name: ci_py39
    create-args: python=3.9
Install micromamba
  Destination file path /home/ubuntu/micromamba-bin/micromamba already exists
  Waiting 11 seconds before trying again
  Destination file path /home/ubuntu/micromamba-bin/micromamba already exists
  Waiting 10 seconds before trying again
  Error: Error installing micromamba: Destination file path /home/ubuntu/micromamba-bin/micromamba already exists
Error: Destination file path /home/ubuntu/micromamba-bin/micromamba already exists

Current workaround: cannot use setup-micromamba@v1, install mamba outside of gha as I keep the same runner, and install + setup the env manually like this:

- name: Setup python env
  run: |
    env=ci_py39
    if ! mamba env list | grep --word-regexp --quiet $env; then
      mamba create -n $env python=3.9 --yes
    fi
    echo $(conda info --base)/envs/$env/bin >> $GITHUB_PATH
- name: Install package
  run: |
    pip install ...
jonashaag commented 11 months ago

How long does it take to install on your server?

0xbe7a commented 10 months ago

I would also appreciate a option to use an already installed version of micromamba instead of downloading micromamba for each run. In the self-hosted runner scenario environment i am running in, i have very restricted network access and would like to avoid external traffic completely.

pavelzw commented 10 months ago

I think having an explicit option

use-from-path: true

that skips downloading could work. I'll take a look at it.

pavelzw commented 10 months ago

@artemisart please use

- uses: mamba-org/setup-micromamba@v1
  with:
    download-micromamba: false
    micromamba-binary-path: /path/to/micromamba # optional if micromamba is on PATH