Installing Additional Python Modules to DIAdem

Updated Nov 21, 2023

Environment

Software

  • DIAdem

Programming Language

  • Python

This article outlines the steps you can follow to install additional Python modules in DIAdem, either interactively or programmatically.

Software required:
  • DIAdem
  • Python
  • PyWin32 module installed

For DIAdem versions up to 2022 Q4, DIAdem installs Python.  As of DIAdem 2023 Q2, DIAdem will no longer install Python. If you want to use Python scripts in DIAdem, install a Python version supported by DIAdem, which can be found at https://www.python.org/ if you don't have it installed.

Make sure DIAdem and Python's versions are compatible. You can verify the compatibility between DIAdem and Python on the corresponding readme document.

You can install additional Python modules interactively, programmatically or manually (as you would install additional python modules in your machine even without DIAdem). 
 

Interactively

    1. Open DIAdem.
    2. Navigate to Settings>> DIAdem Settings>> Script.
    3. Enter the Python module name in the corresponding textbox.
    4. Click the Install / Update Module button.
 
DIAdem Settings Script.png
 

Programmatically

You can achieve the same result programmatically by creating a script that calls the Command Prompt and runs the pip install command. For a Python script, you would use the command subprocess.run(["pip", "install", "ModuleName"]). In case you also want to display the module installation output in DIAdem, you can use the following example where the Panda module is being installed (besides the two lines of code, an import has been added at the top):
 

ScriptExample.png


Manually

  1. Launch the Windows Command Prompt as administrator.
  2. Navigate to the DIAdem installation of Python cd C:\Program Files\National Instruments\Shared\Skyline\Python
  3. Navigate into the Python version folder, and then into the Scripts folder.
  4. Perform any necessary install using pip install moduleName
 

Additional Information

Information about how DIAdem finds the Python version to work with:
  • First DIAdem takes the Python version which is entered in the DIAdem configuration for SCRIPT.
  • If this is empty (the default) DIAdem takes the Python version which is entered in the Windows path environment.
  • In all other cases and if DIAdem finds an installed version that is not 3.7 or 3.6, DIAdem takes the version which is installed together with DIAdem.