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

ImportError: No module named conda.cli #298

Open
VascoSch92 opened this issue Oct 20, 2023 · 8 comments
Open

ImportError: No module named conda.cli #298

VascoSch92 opened this issue Oct 20, 2023 · 8 comments

Comments

@VascoSch92
Copy link

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 :-)

@mattwthompson
Copy link

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

@VascoSch92
Copy link
Author

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

@jaimergp
Copy link
Member

Dors your repo contain a conda directory by any chance?

@VascoSch92
Copy link
Author

No. There is no conda directory.

@jaimergp
Copy link
Member

Can you share full logs? Thanks!

@VascoSch92
Copy link
Author

VascoSch92 commented Oct 20, 2023

/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

@jaimergp
Copy link
Member

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?

@goanpeca
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants