Install PyWorkbench#

Installing PyWorkbench is as simple as installing any Python library. However, you must have a running instance of Workbench to use PyWorkbench.

PyWorkbech has two installation modes: user and developer.

Install in user mode#

You can install PyWorkbench in user mode from PyPI sources using pip or from the GitHub repository:

python -m pip install ansys-workbench-core
export TWINE_USERNAME="__token__"
export TWINE_REPOSITORY_URL="https://pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/upload"
export TWINE_PASSWORD=***
python -m pip install ansys-workbench-core
python -m pip install git+https://github.com/ansys/pyworkbench.git@v0.7.0

Install in developer mode#

Developer installation is specifically intended for project maintainers. This specialized installation is tailored to equip developers with the essential tools and resources required for effective contribution to the project’s development and maintenance. The developer installation assumes a certain level of technical expertise and familiarity with the project’s codebase, rendering it most suitable for individuals actively engaged in its continuous development and maintenance.

  1. Cloning the repository:

    git clone git@github.com:ansys/pyworkbench
    
  2. Move inside the project and create a clean Python environment:

    py -m venv <venv>
    
    py -m venv <venv>
    
    python -m venv <venv>
    
  3. Activate the environment:

    <venv>\Scripts\activate.bat
    
    <venv>\Scripts\Activate.ps1
    
    source <venv>/bin/activate
    
  4. Install the project in editable mode, which means that any changes you make to the package’s source code is immediately reflected in your project without requiring you to reinstall it.

    python -m pip install --editable .
    

Verify your installation#

If Ansys Workbench is installed locally, you can verify your PyWorkbench installation by starting a Workbench server session on your local machine:

from ansys.workbench.core import launch_workbench

workbench = launch_workbench()