Comphy is a free framework provided as a Python package. This enables full control and advanced simulations with Comphy on both Windows and Linux operating systems.
The Python package can be downloaded directly from the downloads section after free registration.
This section will guide you through the necessary steps to setup a virtual Python environment with Comphy.
Before you begin, make sure Python is installed on your platform (we recommend Python version >= 3.6 for use with Comphy).
Setting up a Python environment with Comphy
Step 1: Create and activate virtual Python environment
First, let's create a new virtual Python environment for Comphy.
In this tutorial we will use the module 'venv' which is installed by default since Python 3.3.
(of course you can also use a package management system like conda to set up a virtual Python environment).
To create a virtual environment using the module 'venv' execute the following command, replacing </path/to/new/virtual/environment> with the preferred target directory where you want the new environment to be created:
python -m venv </path/to/new/virtual/environment>
Next, we activate the created Python environment. The virtual environment can be “activated” using the provided activation script in its binary directory (bin on POSIX; Scripts on Windows).
This will prepend that directory to your PATH, so that running python will invoke the environment’s Python interpreter. You’ll need to use different syntax for running the activation script depending on the platform you’re using.
Step 2: Ensure pip, setuptools, and wheel are up to date
While pip alone is sufficient to install from pre-built binary archives,
up-to-date copies of setuptools and wheel are required to ensure you can also install from source archives.
To update to the latest version of setuptools and wheel enter the following command in the shell:
python -m pip install --upgrade pip setuptools wheel
Step 3: Download and install Comphy using pip
Next let's download Comphy from the downloads section and extract the downloaded zip file.
In the following we assume that the source code has been extracted into the directory </path/to/source/code>.
Once you have extracted the zip file, Comphy can be installed in the activated Python environment using pip.
The following command, builds the package into a wheel and installs the wheel, including all necessary dependencies:
python -m pip install </path/to/source/code>
Step 4: Check installation
Finally, verify that the installation was successful by entering the following command in the shell:
python -m pip list
This command lists all packages installed in the current Python environment.
If the installation was successful, you should see an entry for Comphy displaying the current version number:
- On POSIX using the bash/zsh shell:
- On POSIX using the csh/tcsh shell:
- On POSIX using the PowerShell shell:
- On Windows using the cmd shell:
- On Windows using the PowerShell shell: