A teammate of mine just started seeing an issue wh...
# general
e
A teammate of mine just started seeing an issue where a docker container (pex image inside docker) won't run anymore. On trying to run the container with the pex file as the cmd, we get this:
Copy code
Attaching to api_server-1
api_server-1  | Could not find platform independent libraries <prefix>
api_server-1  | Could not find platform dependent libraries <exec_prefix>
api_server-1  | Python path configuration:
api_server-1  |   PYTHONHOME = (not set)
api_server-1  |   PYTHONPATH = (not set)
api_server-1  |   program name = '/opt/app/bin/python3.12'
api_server-1  |   isolated = 0
api_server-1  |   environment = 0
api_server-1  |   user site = 0
api_server-1  |   safe_path = 0
api_server-1  |   import site = 1
api_server-1  |   is in build tree = 0
api_server-1  |   stdlib dir = '/opt/pyenv/versions/3.12.7/lib/python3.12'
api_server-1  |   sys._base_executable = '/opt/app/bin/python3.12'
api_server-1  |   sys.base_prefix = '/opt/pyenv/versions/3.12.7'
api_server-1  |   sys.base_exec_prefix = '/opt/pyenv/versions/3.12.7'
api_server-1  |   sys.platlibdir = 'lib'
api_server-1  |   sys.executable = '/opt/app/bin/python3.12'
api_server-1  |   sys.prefix = '/opt/pyenv/versions/3.12.7'
api_server-1  |   sys.exec_prefix = '/opt/pyenv/versions/3.12.7'
api_server-1  |   sys.path = [
api_server-1  |     '/opt/pyenv/versions/3.12.7/lib/python312.zip',
api_server-1  |     '/opt/pyenv/versions/3.12.7/lib/python3.12',
api_server-1  |     '/opt/pyenv/versions/3.12.7/lib/python3.12/lib-dynload',
api_server-1  |   ]
api_server-1  | Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
api_server-1  | Python runtime state: core initialized
api_server-1  | ModuleNotFoundError: No module named 'encodings'
api_server-1  | 
api_server-1  | Current thread 0x00007aa838146740 (most recent call first):
api_server-1  |   <no Python frame>
api_server-1 exited with code 1
Any thoughts on how to debug?
So far we've tried: 1. Deleted cache 2. Re-Created Python Venv 3. Killed pants Pids 4. Re-Packaged
f
Does the error reproduce if you load a Python repl inside the image and try to
import encodings
?
e
Turned out to be a UID issue within the container