Skip to main content

Introduction and Prerequisites

Embedded Python allows you to use Python as a native option for programming InterSystems IRIS applications. If you are new to Embedded Python, read Introduction to Embedded Python, and then read this document for a deeper dive into Embedded Python.

While this document will be helpful to anyone who is learning Embedded Python, some level of ObjectScript familiarity will be beneficial to the reader. If you are a Python developer who is new to InterSystems IRIS and ObjectScript, also see the Orientation Guide for Server-Side Programming.

Recommended Python Version

The version of Python recommended when using Embedded Python depends on the platform you are running. In most cases, this is the default version of Python for your operating system. See Other Supported Features for a complete list of operating systems and the corresponding supported version of Python.

Note:

On some operating systems, you can override the recommended version of Python using the Flexible Python Runtime feature.

Microsoft Windows does not come with a default version of Python, and as of InterSystems IRIS 2024.2, the InterSystems IRIS installer for Windows no longer installs Python for you. See Flexible Python Runtime Feature for information on setting up Embedded Python for Windows.

Many flavors of UNIX-based operating systems come with Python installed. If you need to install it, use the version recommended for your operating system by your package manager, for example:

  • Ubuntu: apt install python3

  • Red Hat Enterprise Linux or Oracle Linux: yum install python3

  • SUSE: zypper install python3

  • macOS: Install Python 3.11 using HomebrewOpens in a new tab.

    brew install python@3.11

    You should also make sure you are using the current version of OpenSSL:

    brew unlink openssl
    brew install openssl@3
    brew link --force openssl@3
    
  • AIX: Install Python 3.9.18+ using dnf (dandified yum) from the AIX Toolbox for Open Source SoftwareOpens in a new tab

If you get an error that says “Failed to load python,” it means that you either don’t have Python installed or an unexpected version of Python is detected on your system. Check Other Supported Features and make sure you have the required version of Python installed, and if necessary, install it or reinstall it using one of the above methods. Or, override the recommended Python version by using the Flexible Python Runtime feature. (Not available on all platforms.)

If you are on a platform that does not support the Flexible Python Runtime feature, your computer has multiple versions of Python installed, and you try to run Embedded Python from the command line, irispython will run the first python3 executable that it detects, as determined by your path environment variable. Make sure that the folders in your path are set appropriately so that the required version of the executable is the first one found. For more information on using the irispython command, see Start the Python Shell from the Command Line.

Required Service

To prevent IRIS_ACCESSDENIED errors while running Embedded Python, enable %Service_Callin. In the Management Portal, go to System Administration > Security > Services, select %Service_CallIn, and check the Service Enabled box.

Flexible Python Runtime Feature

On Microsoft Windows, as of InterSystems IRIS 2024.2, the installer no longer installs a default version of Python. Download any version of Python 3.9 or higher from https://www.python.org/downloads/Opens in a new tab. Make sure to do a custom installation and install Python for all users.

Important:

The installer for InterSystems IRIS 2024.1 on the Windows platform previously installed OpenSSL 3.1.1 along with Python 3.9.5. However, installing Python 3.9 from Python.org installs OpenSSL 1.1.1n. If you need to use OpenSSL 3 with Embedded Python on InterSystems IRIS 2024.2, install Python 3.11 or higher.

On InterSystems IRIS 2024.2 for Windows, the AutoML feature of IntegratedML requires using Python 3.11.

On other operating systems that support the Flexible Python Runtime feature, you can override the default version of Python. This is useful if you are writing code or using a package that depends on a version of Python other than the one recommended. You must use a version of Python that is the same or greater than your operating system's default version. For example, Red Hat Enterprise Linux 9 comes with Python 3.9, so on that operating system you must use version 3.9 or higher.

In either of these cases, follow the steps below to configure the version of Python to be used by Embedded Python:

  1. In the Management Portal, go to System Administration > Configuration > Additional Settings > Advanced Memory.

  2. On the Advanced Memory Settings page, in the PythonRuntimeLibrary row, click Edit.

  3. Enter the location of the Python runtime library you want to use.

    This location will vary based on your operating system, Python version, and other factors.

    Windows example: C:\Program Files\Python311\python3.dll (Python 3.11 on Windows)

    Linux example: /usr/lib/x86_64-linux-gnu/libpython3.11.so.1.0 (Python 3.11 on Ubuntu 22.04 on the x86 architecture)

  4. Click Save.

  5. On the Advanced Memory Settings page, in the PythonRuntimeLibraryVersion row, click Edit.

  6. Enter the version number of the Python runtime library you want to use.

    For example: 3.11

  7. Click Save.

For more information, see PythonRuntimeLibrary and PythonRuntimeLibraryVersion.

Note:

The Flexible Python Runtime feature is not supported on all operating systems. See Other Supported Features for a complete list of platforms that support the feature.

If you install a new version of Python and cannot find the Python runtime library, you may need to install it separately. For example, to install the Python 3.11 runtime library on Ubuntu 22.04: apt install libpython3.11.

On Microsoft Windows, if you find that the Python runtime library is located within your user directory, for example, C:\Users\<username>\AppData\Local\Programs\Python\Python311, it indicates that you have installed Python for the current user only. InterSystems recommends installing Python for all users to avoid unexpected results.

For more details on how to configure this feature, including step-by-step examples, see Use the Flexible Python Runtime Feature.

FeedbackOpens in a new tab