setup-miniconda icon indicating copy to clipboard operation
setup-miniconda copied to clipboard

ImportError: No module named conda.cli

Open VascoSch92 opened this issue 1 year ago • 8 comments

Hey, i have a really strange problem.

I have two projects where i use the same identical workflow:

...
  steps:
      - name: Checkout branch
        uses: actions/checkout@v3
      - uses: conda-incubator/setup-miniconda@v2
        with:
          miniconda-version: "latest"
          activate-environment: test
...

The problem is that in one project, it works fine, while in the other i have the following error:

 Traceback (most recent call last):
    File ".../condabin/conda", line 12, in <module>
      from conda.cli import main
  Warning: ImportError: No module named conda.cli

Do you have an idea what can be? I'm using self-hosted runner.

Thanks :-)

VascoSch92 avatar Oct 20 '23 05:10 VascoSch92

Do you have full workflows somebody could use to reproduce this behavior? Logs?

mattwthompson avatar Oct 20 '23 05:10 mattwthompson

This is the complete workflow

name: Linting with Ruff

on:
  pull_request:
    branches:
      - '**'  # the workflow is activated on every PR
      
jobs:
  linting_with_ruff:
    name: Linting with Ruff
    runs-on: self-hosted
    steps:
      - name: Checkout branch
        uses: actions/checkout@v3
      - uses: conda-incubator/setup-miniconda@v2
        with:
          miniconda-version: "latest"
          activate-environment: ruff
      - name: Install Ruff
        shell: bash -el {0}
        run: |
          conda activate ruff
          conda install -c conda-forge ruff
      - name: Linting with Ruff
        shell: bash -el {0}
        run: |
          ruff check . --config=ruff.toml
  1. The workflow crashes at the step uses: conda-incubator/setup-miniconda@v2
  2. I have another repository with the same (copy/paste) workflow and in the other repository works
  3. can it be that it is because of some env variables? Like PATH. I don't know how conda-incubator/setup-miniconda@v2 works under the hood

thank you for your help

VascoSch92 avatar Oct 20 '23 07:10 VascoSch92

Dors your repo contain a conda directory by any chance?

jaimergp avatar Oct 20 '23 07:10 jaimergp

No. There is no conda directory.

VascoSch92 avatar Oct 20 '23 07:10 VascoSch92

Can you share full logs? Thanks!

jaimergp avatar Oct 20 '23 09:10 jaimergp

/disk2/home/github/self-hosted/01/_work/project_dir/project_source/3/condabin/conda config --add pkgs_dirs /disk2/home/github/conda_pkgs_dir
  Warning: Traceback (most recent call last):
    File "/disk2/home/github/self-hosted/01/_work/project_dir/project_source/3/condabin/conda", line 12, in <module>
      from conda.cli import main
  ImportError
  Traceback (most recent call last):
    File "/disk2/home/github/self-hosted/01/_work/project_dir/project_source/3/condabin/conda", line 12, in <module>
      from conda.cli import main
  ImportError::warning::: No module named conda.cli%0A
  : No module named conda.cli
Error: The process '/disk2/home/github/self-hosted/01/_work/project_dir/project_source/3/condabin/conda' failed with exit code 1

This is the log of the error i have from the workflow

VascoSch92 avatar Oct 20 '23 09:10 VascoSch92

With that amount of info is hard to say, but it could be one of:

  • A different python is being invoked (check PATH)
  • A different site-packages is being search (check PYTHONPATH)

With the full logs as provided by the GHA download would allow me to check more things. If they are confidential, you can share them by email or Element?

jaimergp avatar Oct 20 '23 10:10 jaimergp

I think the issue might be related to "I'm using self-hosted runner"

goanpeca avatar Nov 14 '23 21:11 goanpeca