Views:

Symptom

- PTV Visum was unable to find a suitable Python 2.7/3.7/3.9 installation.
- Python 2.7 and/or 3.7/3.9 is listed as "not available" in the "User Preferences" menu.
- AddIns and Python scripts do not work.

Examples:
Attempting to open
Scripts -> Python Console
results in a crash or an error message:
"No suitable installation of Python 3.7 was found".
"No valid scripting environment is defined for the AddIn .."
AddIns like "Calculate Matrix" cause an error message or a crash.

Cause

A matching Python version has not been installed or cannot be found.

PTV Visum 2022 and later supports only Python 3.9 64 bit.
PTV Visum 2020 supports the Python 64 bit versions 2.7 and 3.7
Principally parallel installations of other Python versions are possible (e.g also 3.8).
Visum needs a correct Python installation (system wide for python 3.9) along with corresponding registry settings as well as the python package pywin32. After installation, this package must be registered as described at
https://github.com/mhammond/pywin32#installing-via-pip
Support is only granted for setups available in http://cgi.ptvgroup.com/php/vision-setups/

Resolution

Regarding Python 3.9 (3.7 analogous)
First, remove all Python 3.9-installations,
then delete both registry keys manually (if still existing)
HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\3.9
HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.9
then reinstall Python 3.9 using the PTV Python setup from
http://cgi.ptvgroup.com/php/vision-setups/

Notes on Python 3.9:
On startup Visum tries to load the DLL "pythoncom39.dll" and uses as search path the sub folder "Lib\site-packages\pywin32_system32" of the path given by the registry key “InstallPath” (\SOFTWARE\Python\PythonCore\3.9\InstallPath).
Two files "pythoncom39.dll" and "pywintypes39.dll" should be located in this directory.
Additionally, the file “python39.dll” should be located in the directory given by the registry key “InstallPath” itself.
When trying to load the DLL "pythoncom39.dll" an additional search in the system directory (Windows\system32) and possibly also in the directories of the PATH-environment variable is performed.
To make sure that there are no other variants of this DLL on the computer, you may search for the file "pythoncom39.dll" on the entire computer.
After trying to execute a python script, the content of the file protocol.txt (see menu File->Show log files) might also deliver information on possible problems when loading Python.
In case an error occurs when importing any further python packages, it may be caused by the environment variable PYTHONPATH, if it is set to a directory that contains python packages of another python version.