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

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

Closed
hstoebel opened this issue Dec 8, 2022 · 3 comments · Fixed by #1431
Closed

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

hstoebel opened this issue Dec 8, 2022 · 3 comments · Fixed by #1431
Assignees

Comments

@hstoebel
Copy link

hstoebel commented Dec 8, 2022

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!

@RasmusWL RasmusWL self-assigned this Dec 9, 2022
@RasmusWL
Copy link
Member

RasmusWL commented Dec 9, 2022

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?

@hstoebel
Copy link
Author

hstoebel commented Dec 9, 2022

@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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@RasmusWL @hstoebel and others