Starting Python External language in container generates error
I'm trying to get the python external language server started up in a container I am starting. The container is up and running but I cannot get the python language server to start.
This is the error that is coming back when trying to start the language server. I have tried creating a custom image with that package installed but it still does not work. Is there something specific that needs to be done to to get this working? (FYI, I have the dotnet version working but creating a custom image and installing the dotnet runtimes via a docker file)
Base iris container:containers.intersystems.com/intersystems/irishealth:2024.1
"On Debian/Ubuntu systems, you need to install the python3-venv package using the following command. apt install python3.10-venv"
Comments
In a container, the Python external language/embedded Python support depends on the OS-level Python installation being present and compatible. For UNIX/Linux, the documented requirement is to install Python using the system package manager, for example on Ubuntu: apt-get install python3. If package installation with pip is needed, python3-pip may also need to be installed with the system package manager. [1][2]
If the startup error you are seeing is related to virtual environments, one retrieved container setup example explicitly installs both python3-pip and python3-venv in the image:
RUN apt-get update && apt-get install -y \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
For embedded Python in containerized IRIS, there is also an example stating that the CallIn service must be enabled:
[Actions]
ModifyService:Name=%Service_CallIn,Enabled=1,AutheEnabled=48
One retrieved example also states:
CRITICAL: Must enable CallIn service for embedded Python to work. [3]
If you are running Python code through the IRIS-provided Python executable, the retrieved material says to use /usr/irissys/bin/irispython, not the system python:
exec /usr/irissys/bin/irispython -m your_server_module
One retrieved container-related example also shows that authentication/environment variables may be required when running embedded Python from a container, including IRISUSERNAME, IRISPASSWORD, and IRISNAMESPACE. [4]
[!NOTE]
Embedded Python is designed to run with whatever version of Python you have installed on your machine. [1][2]
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 installed on your system. Install it or reinstall it using one of the above methods. [1][2]
So based on the retrieved material, the things to verify in your custom image are:
- Install OS-level Python in the container, at least
python3, and if neededpython3-pipandpython3-venv. [3][1][2] - Make sure
%Service_CallInis enabled. [3] - Run with
/usr/irissys/bin/irispythonfor embedded Python scenarios. [3] - If applicable, set the required IRIS environment variables for authentication/namespace access. [4]
I cannot confirm from the retrieved material alone whether python3.10-venv specifically is required for irishealth:2024.1, only that python3-venv appears in the container example and python3 is the documented package family to install on Ubuntu. [3][1][2]
Sources: