I have a pyz that I'm building on GitHub using an Ubuntu docker container. We're using poetry's pyinstaller command. something like: poetry run pyinstaller test_pyz.spec --noconfirm --distpath build/pyz The test_pyz.spec file has # -*- mode: python ; coding: utf-8 -*- at the top. When I take the file and copy it to a Mac and run python3 test.pyz I am getting the following error: SyntaxError: Non-UTF-8 code starting with '\xb9' in file /tmp/test.pyz on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details I have tried also setting an environment variable before the poetry command but have the same problem: PYTHONIOENCODING=utf-8 poetry run pyinstaller test_pyz.spec --noconfirm --distpath build/pyz Any suggestions on what else to check for? It seems like all of the encoding is correct so I'm not sure what's going on here. After some more thought, I don't think we're creating a true pyz but a python executable via pyinstaller. Are we using this wrong? Continue reading...