8000 "No module named 'msvcrt'" on Ubuntu 20.04 self-hosted runner · Issue #289 · actions/setup-python · GitHub
[go: up one dir, main page]

Skip to content
"No module named 'msvcrt'" on Ubuntu 20.04 self-hosted runner #289
Closed
@mikedalton

Description

@mikedalton

Description:

When following instructions to set up an Ubuntu 20.04 self-hosted runner's tool cache with Python 3.10, subsequently running a workflow that checks out the repo, sets up python, sets up the scottbrenner/cfn-lint-action@v2 action, and then runs cfn-lint --version results in the following error:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/subprocess.py", line 69, in <module>
    import msvcrt
ModuleNotFoundError: No module named 'msvcrt'

Deploying the Python tool cache into the Actions runner client's _work/_tool directory results in a successful run of cfn-lint --version, but then with other workflows encounters errors building Docker containers.

Action version:

actions/setup-python@v2

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

3.10 (others untested)

Repro steps:

  1. Build tool cache with following workflow step:
      - name: Setup Python 3.10
        uses: actions/setup-python@v2
        with:
          python-version: '3.10'
  1. As per setup-python instructions for deploying to hosted tool cache on Linux, copy and extract artifact to /opt/hostedtoolcache/

  2. Attempt to run the following workflow:

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

      - name: Install Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.x'

      - name: Setup Cloud Formation Linter with Latest Version
        uses: scottbrenner/cfn-lint-action@v2

      - name: Print the Cloud Formation Linter Version & run Linter.
        run: |
          cfn-lint --version
          cfn-lint

Expected behavior:

Successful run of second workflow, with an output similar to the following:

cfn-lint 0.55.0

Actual behavior:

Receive output similar to the following:

/opt/hostedtoolcache/Python/3.10.0/x64/bin/python3 --version
Python 3.10.0
/opt/hostedtoolcache/Python/3.10.0/x64/bin/python3 -m venv /tmp/setup-cfn-lint-3DRQLm/.venv
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/subprocess.py", line 69, in <module>
    import msvcrt
ModuleNotFoundError: No module named 'msvcrt'
....
  File "/opt/hostedtoolcache/Python/3.10.0/x64/lib/python3.10/subprocess.py", line 74, in <module>
    import _posixsubprocess
ModuleNotFoundError: No module named '_posixsubprocess'

The output is very unusual, as it references module msvcrt (Microsoft VC++ runtime), despite nothing in the workflow, Python build, or Actions runner involving Windows or the VC++ runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0