EnvisionSCADA ships a set of Python libraries with the application, so they are available in every script and in the Report Designer on every installation without installing anything: requests (HTTP client, including its dependencies urllib3, idna, certifi, and charset_normalizer), fpdf (PDF generation), openpyxl and XlsxWriter (Excel files), and et_xmlfile. Import them directly, for example import requests.
The steps on this page are only needed for additional libraries beyond this set. A library uploaded to the Python Libraries section of the Project panel takes precedence over the shipped version, so a project can pin its own version of any of these libraries.
You do not need to stop EnvisionSCADA to install additional libraries.
For example, if we wish to install fpdf (creating PDF reports).
First, let's upgrade PIP with the following command:
python.exe -m pip install --upgrade pipNext, let's install the library with the following command:
pip install fpdfpython -m site --user-siteYou may always copy the file to the right directory manually. After the files are in the right place, you can immediately use the new library, without needing to restart EnvisionSCADA.
Make sure that pip installs the package in the correct repository used by EnvisionSCADA:
C:\Program Files\Python312\Lib\site-packages
If you want to know where it installed the package, you can use the following command:
This page covers installing third-party libraries. To reuse your own code across scripts, you do not need a library: mark a Python script as a module and import it from other scripts. See the Python Scripts article (Modules and reuse).
There is a second location that scripts import from: the Python Libraries section of the Project panel in the Quick Menu (CTRL+Q). That folder is added to the Python search path as well, and it is searched before the site-packages folder shown above.
Use it when you work from a remote client and have no file system access to the server, because files are uploaded there through the interface. Use the pip method above when the package has to be installed with its dependencies. See the Project Files article.
Python Runtime
EnvisionSCADA runs Python scripts, reports, and UDT logic on Python 3.12 (64-bit). The EnvisionSCADA installer installs Python 3.12.10 in C:\Program Files\Python312 when that installation is not present.
At every start, the System Log records which Python runtime was loaded and from which location, with the origin PythonScript:
Python 3.12.10 loaded from C:\Program Files\Python312\python312.dll (default location).EnvisionSCADA uses Python 3.12 only, also when other Python versions are installed on the server. When Python 3.12 is not found, or cannot be loaded, the System Log shows an error with the origin PythonScript that names the location where Python 3.12 was expected:
Error: Python 3.12 (64-bit) was not found (looked for C:\Program Files\Python312\python312.dll and a Python 3.12 registration under SOFTWARE\Python\PythonCore). Python scripts, reports and UDT logic are disabled until Python 3.12 is installed and the application is restarted. The EnvisionSCADA installer installs it.Python scripts, reports, and UDT logic become available after Python 3.12 (64-bit) is installed and the EnvisionSCADA application pool in IIS is restarted. Devices, alarms, and all other functions keep running in the meantime.
Upgrading from Python 3.11
EnvisionSCADA versions before the change to Python 3.12 run on Python 3.11. The installer installs Python 3.12 next to Python 3.11 and leaves Python 3.11 installed; EnvisionSCADA uses Python 3.12 from then on.
Libraries installed with pip belong to one Python installation, so libraries that were installed for Python 3.11 have to be installed again for Python 3.12. The libraries that ship with EnvisionSCADA need no action. The following commands list the libraries of the Python 3.11 installation and install the same list for Python 3.12:
"C:\Program Files\Python311\python.exe" -m pip freeze > C:\Temp\python-libraries.txt
"C:\Program Files\Python312\python.exe" -m pip install -r C:\Temp\python-libraries.txtA version number in the list can be older than the first version of that library that supports Python 3.12. When pip reports that it cannot install a listed version, remove the version number from that line, so that pip installs the current version of the library, and run the install command again.
On a server without internet access, download the libraries on a computer with internet access and Python 3.12 (64-bit), copy the folder to the server, and install from that folder:
py -3.12 -m pip download -r C:\Temp\python-libraries.txt -d C:\Temp\python-wheels
"C:\Program Files\Python312\python.exe" -m pip install --no-index --find-links C:\Temp\python-wheels -r C:\Temp\python-libraries.txtLibraries uploaded to the Python Libraries section of the Project panel that contain compiled files (.pyd) are built for one Python version. Replace them with a build for Python 3.12. Libraries that consist of Python source files only keep working.