Deployment failed python

I have a simple app uses gradio and env variables to make api requests. The app was deployed once but never builds again on koyeb but it builds everywhere else with any python version.

The build keeps failing due to

sys._base_executable = ‘/usr/bin/python’
sys.base_prefix = ‘/home/koyeb/.heroku/python’
sys.base_exec_prefix = ‘/home/koyeb/.heroku/python’
sys.platlibdir = ‘lib’
sys.executable = ‘/usr/bin/python’
sys.prefix = ‘/home/koyeb/.heroku/python’
sys.exec_prefix = ‘/home/koyeb/.heroku/python’
sys.path = [
‘/home/koyeb’,
‘/home/koyeb/.heroku/python/lib/python310.zip’,
‘/home/koyeb/.heroku/python/lib/python3.10’,
‘/home/koyeb/.heroku/python/lib/python3.10/lib-dynload’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’
Current thread 0x00007fcc61638000 (most recent call first):

Timer: Builder ran for 22.773771065s and ended at 2025-05-17T21:32:42Z
ERROR: failed to build: exit status 1
Build failed :cross_mark:

Hi,

I just checked your service which is now healthy and running. So no more issues, correct?

It looks like the issue might be related to the Python runtime not being set up correctly during the build. Make sure your project includes a runtime.txt file with a valid Python version, for example: python-3.10.12. This helps ensure Koyeb installs the correct Python environment.

Also, check that your custom build command in the service settings is empty (unless you specifically need one). A non-empty build command can override Koyeb’s default behavior and break Python’s setup.

Lastly (as @David already mentioned your service is now healthy), sometimes rebuilding your service may also fix the issue.

My first reply, let me know if it helped!