Fatal Python error: Py_Initialize: Unable to get the locale encoding

Not sure if it’s related or not, but I seem to be getting this after upgrading to 19.10. When trying to build a python part:

  aws-cli:
    after:
      - cni-plugins
    plugin: python
    python-version: python3
    python-packages:
      - awscli

I get

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f87a4e8b740 (most recent call first):
Failed to run '/root/stage/usr/bin/python3 -m pip download --disable-pip-version-check --dest /root/parts/aws-cli/python-packages pip': Exited with code -6.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.

This was working, so not sure what’s happened? Maybe with the Python2-3 namespace change?

core                    16-2.42                     7917   stable       canonical✓          core
snapcraft               3.8                         3440   stable       canonical✓          classic