2

I just upgraded to Pop OS(Ubuntu) 20.04, which upgraded Python 3.7 to 3.8. Now I get this error below when I run sam (from the AWS SAM CLI). Solutions found online all had to do with making sure python3-distutils is installed. I have verified that python3-disutils is installed. /usr/lib/python3.8/distutils looks fine, just not getting picked up for some reason.

One thing I noticed is that in the traceback below, it's using the system-wide pip, while I have a later version of pip installed under my .local. I don't know if those two symptoms are related but looks like I'm missing some config somewhere so none of the 3.8 or user space stuff is picked up.

Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/pip/_internal/main.py", line 14, in main
    from pip._internal.utils.entrypoints import _wrapper
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/entrypoints.py", line 3, in <module>
    from pip._internal.cli.main import main
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
jingx
  • 3,698
  • 3
  • 24
  • 40

1 Answers1

0

I have the same issue on Debian Bullseye (or rather mixed Bullseye/Buster).

Package python3-distutils (3.8.6) contains module for Python 3.8 and 3.9 (!). Old package (3.7.3) for Python 3.7. You have to choose.

My workaround is just copy module.

mkdir -p /usr/lib/python3.7/distutils
cp -a /usr/lib/python3.8/distutils/* /usr/lib/python3.7/distutils/
rysson
  • 180
  • 2
  • 10