Python setup

Requires the following resources:

  • Python Simian GUI release zip file.
  • License file valid for your machine.

Setup steps:

  1. Unzip the archive with the Python version of Simian GUI to a temporary location. Refer to section Simian GUI contents for more information about its contents.

  2. Create and activate a Python environment.

    Note: If you want to run locally, use Python 3.8 or 3.9. Python 3.10 and above are currently not supported by PyWebview.

  3. Install the packages using pip:

    pip install .\simian-gui .\simian-local .\simian-examples

    Note that for installation on a deployment server the simian-local and simian-examples packages are not required.

    1. The simian-local package installs pywebview as a dependency. To verify it is installed correctly on your system, run the following python commands. A window, displaying the PyWebview web page, should open.

      import webview
      webview.create_window('Hello world', '')
    2. If you want to use Redis cache (for deployed mode) it can be specified as optional dependency of the simian-gui:

      pip install .\simian-gui[redis]
    3. If you need to troubleshoot license failures, you may also want to install the pyarmor dependency.

      pip install .\simian-gui[pyarmor]
  4. Make your license file available by specifying its location in the PYARMOR_LICENSE environment variable, as documented in the license section

Testing your setup

You can test your environment setup by running the following commands in your Python environment:

import simian.gui
form = simian.gui.Form()

If you get a Form object, your environment is setup correctly. If pywebview is installed correctly in your Python environment, you should be able to start the BallThrower example locally by running the following commands:

import simian.local
simian.local.Uiformio("simian.examples.ballthrower", window_title="Ball Thrower")

If you get an error, you can check this against these error messages and solutions:

  • ModuleNotFoundError: No module named 'simian' Simian GUI was not found on the Python path. Ensure that the simian-gui and simian-local packages are installed.

  • ModuleNotFoundError: No module named 'simian.examples.ballthrower' The simian-examples package was not found on the Python path. Ensure that the simian-examples package is installed.

  • ModuleNotFoundError: No module named xxx Ensure that all dependencies are installed in your Python environment.

  • License errors and potential solutions are described in the Invalid license message section.

Simian GUI contents

An overview of the archive contents is shown in the figure below.

  • Documentation The Simian GUI documentation.
    • index.html The main page of the documentation.
  • simian-examples Folder containing the included examples.
    • simian
      • examples
        • Module implementing the BallThrower application. It contains the gui_init and gui_event functions that define the user interface of the application.
        • Module with a class that implements the ball throwing model.
      • Utility for pip installation.
      • Utility for pip installation.
  • simian-gui Folder containing the Simian GUI code.
    • pytransform: Utility for license validation.
    • simian
      • gui Folder containing Simian GUI code.
      • config.json File containing the version number of the front-end.
      • Utility for handling callbacks.
    • Utility for pip installation.
    • Utility for license validation.
    • Utility for pip installation.
  • simian-local Folder containing the code to run Simian GUI locally.
    • simian
      • html Folder containing the front-end build for PyWebview.
      • Utility for communication with tht PyWebview window.
      • The Simian Local module.
    • Utility for pip installation.
    • Utility for pip installation.