Codespaces Python startup exception

(I can’t seem to post this in Codespaces Beta category for some reason - if a mod could help, that’d be awesome!)

I’ve started up a recent Codespace, and the Python auto-detection fails, due to some mismatch in the way Python was built and the OS level libraries that are available.

From my creation.log file:

2021-10-17T21:26:31: image detector file exists, platform is python..
2021-10-17T21:26:31: lrwxrwxrwx 1 codespace codespace 18 Oct 17 21:26 /home/codespace/.python/current -> /opt/python/3.8.12
2021-10-17T21:26:31: Python Version: /opt/python/3.8.12/bin/python3.8
2021-10-17T21:26:32: Creating directory for command manifest file if it doesnot exist
2021-10-17T21:26:32: Removing existing manifest file
2021-10-17T21:26:32: Python Virtual Environment: .venv
2021-10-17T21:26:32: Creating virtual environment...
2021-10-17T21:26:32: Activating virtual environment...
2021-10-17T21:26:38: Running python setup.py install...
2021-10-17T21:26:38: Traceback (most recent call last):
2021-10-17T21:26:38:   File "setup.py", line 3, in <module>
2021-10-17T21:26:38:     from setuptools import setup
2021-10-17T21:26:38:   File "/opt/python/3.8.12/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
2021-10-17T21:26:38:     from setuptools.dist import Distribution
2021-10-17T21:26:38:   File "/opt/python/3.8.12/lib/python3.8/site-packages/setuptools/dist.py", line 38, in <module>
2021-10-17T21:26:38:     from setuptools import windows_support
2021-10-17T21:26:38:   File "/opt/python/3.8.12/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
2021-10-17T21:26:38:     import ctypes
2021-10-17T21:26:38:   File "/opt/python/3.8.12/lib/python3.8/ctypes/__init__.py", line 7, in <module>
2021-10-17T21:26:38:     from _ctypes import Union, Structure, Array
2021-10-17T21:26:38: ImportError: libffi.so.6: cannot open shared object file: No such file or directory
2021-10-17T21:26:38: oryx process exited with exit code 1

The OS is VERSION="20.04.3 LTS (Focal Fossa)" - and this is a known issue that Ubuntu 20.04 distribution upgraded libffi6 to libffi7.

$ find /usr/lib -name "libffi.so*"
/usr/lib/x86_64-linux-gnu/libffi.so.7
/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
/usr/lib/x86_64-linux-gnu/libffi.so

My Codespace is then incompletely set up on startup.