NOTE: this is a living document that is continually updated.
As stated in our Getting started with Python document, we recommend building containerized python applications using python 3.8.11 or 3.9.7. If your docker image is built from a base image, we recommend using a specific image tag like 3.8.11, instead of 3.8. This is because tags like 3.8 may be updated to a newer version, for example 3.8.12, which hasn't been fully tested by us against Mystikos yet. We will do our best to support latest Python versions.
If you run, "apt install python3.8
" e.g., when building a Ubuntu-based docker
image, the installed python executable is non-PIE (position independent
executable). Whereas "myst exec <cmd>
" requires the cmd to be a PIE. We are
aware of three methods to overcome this:
- (Option 1) Install python using miniconda (reference our python_webserver example)
- (Option 2) Use a Debian base image instead. For example,
FROM python:3.9.7-slim
- (Option 3) Build CPython from source. Follow instructions https://github.com/python/cpython#build-instructions
To get a rough idea of whether your Python application can be run in Mystikos, you can reference our known CPython test failures in Mystikos, with v3.8.11 and v3.9.7 respectively. Here are several noteworthy modules we haven't supported yet:
os
os.fork
- fork is not supported in Mystikosos.spawn*
- please note thatos.posix_spawn
IS supportedos.exec*
- not supportedos.openpty
- some cpython tests have not passed (yet)os.memfd_create
multiprocessing.shared_memory
- shared memory is not supported in Mystikos (yet)subprocess
- some parameters ofsubprocess.run
/subprocess.Popen
are not supportedpreexec_fn
shell=True
- as Ubuntu/Debian's default shelldash
is not supported in Mystikos, setting parametershell=True
may require changing the default shell, such as by addingRUN ln -sf /bin/bash /bin/sh
in the Dockerfile- Python3.8 does not use vfork, the option
"ForkMode": "pseudo_wait_for_exit_exec"
is required in config.json to support mostsubprocess
APIs.
threading.Lock
- unsupported (yet)curses
- not supportedtkinter
- not supportedlocale
- musl libc has very limited locale support. Python programs running in Mystikos would suffer the same limitations, since Mystikos bases its C-runtime on musl.- The exact missing functionality related to locate in Python is not deteremined, however you can refer to failed Python unit tests for a rough understanding.
- For example, musl doesn't support
LC_COLLATE
, failing the following Python unit tests: - Other failed unit tests related to locale:
resource
getrusage
: only supports optionRUSAGE_SELF
Caveat: Any third-party Python library that calls into the unsupported standard Python APIs are not supported neither. Sometimes they can produce unpredictable errors which are tricky to root cause.
A rule of thumb is to choose the latest versions of third-party libraries. As we usually test Mystikos against the latest versions.
Supported | Known Limitations & Caveats | Sample/Tests |
---|---|---|
Yes | Not supporting tests based on mmap, rng. | solutions/numpy_core_tests |
Supported | Known Limitations & Caveats | Sample |
---|---|---|
Partial | Some tests in files listed in tests.partially_passed fail/ error out on execution. These failures and error are caused by one of below: 1. pypaper linux specific errors, documented here - https://pyperclip.readthedocs.io/en/latest/#not-implemented-error 2. s3fs error (which is currently an optional file handling mechanism in pandas) https://bleepcoder.com/evalml/557744402/unit-test-fails-after-upgrading-to-pandas-1-0-0 |
solutions/pandas_tests |
Supported | Known Limitations & Caveats | Sample |
---|---|---|
Limited | numpy installed with python3-tflite-runtime is broken. Remove it to use pip-intalled version |
solutions/tensorflow_lite |
Supported | Known Limitations & Caveats | Sample/Tests |
---|---|---|
Limited | We have tested the core functions. More thorough testing is in progress. |
solutions/pytorch_tests |
Supported | Known Limitations & Caveats | Sample/Tests |
---|---|---|
Yes | In nginx.conf, set master_process off to avoid using syscall SYS_rt_sigsuspend() which is not hanlded by Mystikos yetmaster_process off; The following pytest would fail for now because of issue #503. test_instance_config.py::test_egg_installed_paths |
solutions/python_flask_tests |
Supported | Packages | Sample/Tests |
---|---|---|
Yes | The following packages have been verified: - azure-keyvault-administration - azure-keyvault-certificates - azure-keyvault-keys - azure-keyvault-secrets - azure-mgmt-keyvault - azure-identity - azure-storage-file-datalake - azure-storage-file-share - azure-storage-queue - azure-mgmt-storage - azure-mgmt-storagesync - azure-storage-blob |
solutions/python_azure_sdk |
We haven't verified the full test suites of the following packages. Their support status are based on our experience of running applications that call these packages.
Packages | Supported |
---|---|
logzero | Yes |
pycrypto | Yes |
pyjwt | Yes |
nose | Yes |
redis | Yes |
pyodbc | Yes |
sqlalchemy | only works with SQL AE |
pycurl | Yes |
authlib | Yes |
gunicorn | No, it requires full fork() support. It does not work with fork/exec. |
fabric | No (Reason to be found) |