Question
· Feb 3

Py fails in Win Terminal - fixed

USER>do $System.Python.Shell()
 
ERROR #5002: ObjectScript-Error: <OBJECT DISPATCH>Shell+16^%SYS.Python.1 
*Failed to Load Python: Check documentation and messages.log, 
Check CPF parameters:[PythonRuntimeLibrary,PythonRuntimeLibraryVersion], 
Check sys.path setup in: $INSTANCE/lib/python/iris_site.py
02/03/25-18:27:39:497 (13156) 1 [Generic.Event] CPF settings (PythonRuntimeLibraryVersion) do not specify python correctly - Python can not be loaded
02/03/25-18:27:39:498 (13156) 1 [Generic.Event] CPF settings (PythonRuntimeLibrary) do not specify python correctly - Python can not be loaded

my iris.CPF just shows nothing. what is the correctly formatted content ?

^CONFIG("config","PythonPath")=""
^CONFIG("config","PythonRuntimeLibrary")=""
^CONFIG("config","PythonRuntimeLibraryVersion")=""

next from iris_site.py:

>>> print(get_win_python_install_dir())
C:\Program Files\Python313

>>> print( __sitegetsitepackages([get_win_python_install_dir()]))
['C:\\Program Files\\Python313', 'C:\\Program Files\\Python313\\Lib\\site-packages']

>>> print(sys.path)
['', 'C:\\Program Files\\Python313\\python313.zip', 'C:\\Program Files\\Python313\\DLLs', 'C:\\Program Files\\Python313\\Lib', 'C:\\Program Files\\Python313', 'C:\\Program Files\\Python313\\Lib\\site-packages']

Various attempts to set iris.CPF according to docs / examples manually failed
What else can I check?

PythonPath=C:\Program Files\Python313
PythonRuntimeLibrary=C:\Program Files\Python313\python3.dll
PythonRuntimeLibraryVersion=3.13

Also downgrade to Python 3.9.13 didn't improve anything.

Product version: IRIS 2024.3
$ZV: IRIS for Windows (x86-64) 2024.3 (Build 217U)
Discussion (9)1
Log in or sign up to continue

can you give a try to https://github.com/grongierisc/iris-embedded-python-wrapper.

follow the readme, it will give you the instruction to work with venv and a chosen version of python and bind it to iris.

behind the scene, this module help to setup the PythonPath, PythonRuntimeLibray and PythonRuntimeLibrayVersion

let me know, if you find any issue.

Btw, it will not solve the python 3.13 issue, you need to upgrade to 2025.1 to support it.

After un-install of my own python versions
PY was still there in a different hidden and protected version unknown for me.
I detected it using regedit 
C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\ 

I fail to explain where it came from (pre-installed win ?? )
Manual killing it and reinstallation of an official Python distribution fixed it.

BIG THANKS for your advise and help- 

I just identified a possible source of the hidden Python installation:
https://docs.intersystems.com/iris20243/csp/docbook/DocBook.UI.Page.cls?KEY=GEPYTHON_prereqs#GEPYTHON_prereqs_version

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.

I did an upgrade from my previous  IRIS 2024.1