Skip to content

ModuleNotFoundError for http package when using pip after setup #1029

Closed
@silv-io

Description

@silv-io

Description:
When using pip to, e.g., install setuptools after running the action, we sometimes (but not always) get a ModuleNotFoundError: No module named 'http' error.
This doesn't happen always, and a re-run of the GitHub action usually resolves this error.
The error happens inside urllib, and is also filed there: urllib3/urllib3#3558 where they referred to the action.

Action version:
v5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted (buildjet-2vcpu-ubuntu-2204)

Tools version:

Python 3.11

Repro steps:
A description with steps to reproduce the issue. If your have a public example or repo to share, please provide the link.

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install docker helper dependencies
        run: pip install --upgrade setuptools setuptools_scm

Expected behavior:

This should always work without issue.

Actual behavior:

Sometimes (but not always) we get the following error:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.9/x64/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/cli/main_parser.py", line 9, in <module>
    from pip._internal.build_env import get_runnable_pip
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/build_env.py", line 19, in <module>
    from pip._internal.cli.spinners import open_spinner
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/cli/spinners.py", line 9, in <module>
    from pip._internal.utils.logging import get_indentation
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
    from pip._internal.utils.misc import ensure_dir
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 43, in <module>
    from pip._internal.exceptions import CommandError, ExternallyManagedEnvironment
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_internal/exceptions.py", line 18, in <module>
    from pip._vendor.requests.models import Request, Response
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/requests/__init__.py", line 43, in <module>
    from pip._vendor import urllib3
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/urllib3/__init__.py", line 11, in <module>
    from . import exceptions
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/urllib3/exceptions.py", line 3, in <module>
    from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/urllib3/packages/six.py", line 234, in create_module
    return self.load_module(spec.name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/urllib3/packages/six.py", line 209, in load_module
    mod = mod._resolve()
          ^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/urllib3/packages/six.py", line 118, in _resolve
    return _import_module(self.mod)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/urllib3/packages/six.py", line 87, in _import_module
    __import__(name)
ModuleNotFoundError: No module named 'http'

Metadata

Metadata

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