ModuleNotFoundError: No module named 'pip' on github/codeql-action/analyze · Issue #1425 · github/codeql-action · GitHub
Skip to content

ModuleNotFoundError: No module named 'pip' on github/codeql-action/analyze #1425

Closed

Description

@hstoebel

I'm trying to call github/codeql-action/analyze@v2 in my workflow. It ran fine 5 days ago. When I reran for the same commit today it failed

the failed job

  codeql:
    name: security-scan
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        language: [python]

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v2
        with:
          languages: ${{ matrix.language }}

      - name: Autobuild
        uses: github/codeql-action/autobuild@v2

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v2

output from the run

/opt/hostedtoolcache/CodeQL/0.0.0-20221123/x64/codeql/codeql version --format=terse
 2.11.4

  /home/runner/.cache/pypoetry/virtualenvs/my-project-SllqOPWN-py3.10/bin/python -c import os; import pip; print(os.path.dirname(os.path.dirname(pip.__file__)))
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'pip'
  Error: The process '/home/runner/.cache/pypoetry/virtualenvs/my-project-SllqOPWN-py3.10/bin/python' failed with exit code 1
  Error: The process '/home/runner/.cache/pypoetry/virtualenvs/my-project-SllqOPWN-py3.10/bin/python' failed with exit code 1
      at ExecState._setResult (/home/runner/work/_actions/github/codeql-action/v2/node_modules/@actions/exec/lib/toolrunner.js:592:25)
      at ExecState.CheckComplete (/home/runner/work/_actions/github/codeql-action/v2/node_modules/@actions/exec/lib/toolrunner.js:575:18)
      at ChildProcess.<anonymous> (/home/runner/work/_actions/github/codeql-action/v2/node_modules/@actions/exec/lib/toolrunner.js:469:27)
      at ChildProcess.emit (node:events:390:28)
      at maybeClose (node:internal/child_process:1064:16)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

Happy to submit any other relevant information if anything's missing. Any guidance is appreciated!

Activity

  1. self-assigned this
    on Dec 9, 2022
  2. RasmusWL commented on Dec 9, 2022

    @RasmusWL
    Member

    Hi @jstoebel, thanks for reporting this problem. I looks like pip has not been installed in your virtual environment, which breaks all my assumptions about how things work 🤔

    Looks over the docs for poetry, I see that virtualenvs.options.no-pip = true would probably cause this behavior, so I learned something today as well.

    Can you confirm whether your poetry.toml has this option set?

  3. hstoebel commented on Dec 9, 2022

    @hstoebel
    Author

    @RasmusWL virtualenvs.options.no-pip is not set in my pyproject.toml.

    I was able to find a work around however. I was using github/codeql-action/autobuild@v2 to build the project in this job. I removed that and built the project the project the same way I do in other workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions