Title: pip install: ModuleNotFoundError: No module named 'compileall'
Tags: python,ubuntu,installation,pip

Question: I'm running Ubuntu 22.04 LTS ARM on a UTM VM using Apple Virtualization.  When I run python -m pip install, it errors out as follows:
$ python -m pip install hg-git
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3/dist-packages/pip/__main__.py", line 31, in <module>
    sys.exit(_main())
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 68, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 109, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 14, in <module>
    from pip._internal.cli.req_command import (
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 21, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 32, in <module>
    from pip._internal.req import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/__init__.py", line 8, in <module>
    from .req_install import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 39, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/install/wheel.py", line 5, in <module>
    import compileall
ModuleNotFoundError: No module named 'compileall'

How do I fix this error?  I am particularly puzzled because another VM with the same settings does not have this issue.  Thanks in advance!
Solutions I found online seem to suggest fixing the problem by running pip install compileall, but that results in the same error:
$ pip install compileall
Traceback (most recent call last):
  File "/usr/bin/pip", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 68, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 109, in create_command
    module = importlib.import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 14, in <module>
    from pip._internal.cli.req_command import (
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 21, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 32, in <module>
    from pip._internal.req import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/__init__.py", line 8, in <module>
    from .req_install import InstallRequirement
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 39, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/install/wheel.py", line 5, in <module>
    import compileall
ModuleNotFoundError: No module named 'compileall'

Answer: You can have a try of this order:
python -m pip install compileall2