Install Python packages from the command line before using them with Embedded Python. The command you use differs depending on whether you are using InterSystems IRIS on a UNIX-based system, on Windows, or in a container.
Install Python Packages on a UNIX-Based System
On UNIX-based systems, use the pip3 command: pip3 install --target <installdir>/mgr/python <package>.
For example, the ReportLab Toolkit is an open source library for generating PDFs and graphics. On a UNIX-based system, use a command like the following to install it:
$ pip3 install --target /InterSystems/IRIS/mgr/python reportlab
If you do not have pip3 installed already, install the package python3-pip with your system’s package manager.
Install Python Packages in a Container
If you are running InterSystems IRIS in a container without using the durable %SYS feature, use the pip3 command: pip3 install --target /usr/irissys/mgr/python <package>.
For example, you can install the ReportLab package in the container as follows:
$ pip3 install --target /usr/irissys/mgr/python reportlab
If you are running InterSystems IRIS in a container using the durable %SYS feature, use the pip3 command: pip3 install --target <durable>/mgr/python <package>, where <durable> is the path defined in the environment variable ISC_DATA_DIRECTORY when running the container.
For example, if ISC_DATA_DIRECTORY=/durable/iris, you can install the ReportLab package in the container as follows:
$ pip3 install --target /durable/iris/mgr/python reportlab
Note: If you are using a Dockerfile to create a custom Docker image for InterSystems IRIS, install Python packages in /usr/irissys/mgr/python. If then you run the custom container using the durable %SYS feature, set the environment variable PYTHONPATH=/usr/irissys/mgr/python so that this directory is included in sys.path in addition to <durable>/mgr/python.
For more information on creating and running containers, see Running InterSystems Products in Containers.