Skip to content

How to install stepspy in Python

Changgang Li edited this page Feb 5, 2021 · 3 revisions

stepspy is a module wrapping STEPS kernel (dynamic library) in Python. The official package location is: https://pypi.org/project/stepspy/.
It is the RECOMMENDED practice to use stepspy instead of STEPS console for further applications.

Download and install Python

Download the latest version of Python from Python official websit and install it. The Python version must be compatible with STEPS dynamic library. If you use 64-bit version of STEPS dynamic library, use 64-bit Python. Otherwise, use both 32-bit version.
Remember, Python 2 is no longer officially maintained. Use Python 3!

Install stepspy

You have 2 options to install stepspy:

  1. Use Python pip utitlity to install it from pypi. It can be invoked by one of the following commands:
    pip install stepspy
    python -m pip install stepspy
  2. Go to steps source codes, and go find the stepspy module at python/stepspy-current/stepspy. Just copy the codes to folder site-packages of Python.

Install dynamic library

Once you finish building STEPS kernel following the standard procedure, you can find a file named libsteps.dll or libsteps.so_ in folder build/bin/release/. Copy the dynamic library to the stepspy module folder stepspy/libsteps/. For example, if you are using Windows system and the site-packages folder is located at C:/Python/Lib/site-packages, then copy the libsteps.dll to C:/Python/Lib/site-packages/stepspy/libsteps/.

Test stepspy

To test if stepspy is properly installed or not, simply try the following codes in Python:

from stepspy import STEPS
simulator = STEPS()

If you can see the following outputs, then stepspy is ready to use.

[TK DFLT][2021-02-05 12:20:26][   0.002] No configuration file <steps_config.json> is found. Use default power system database capacity.
[TK DFLT][2021-02-05 12:20:26][   0.003] STEPS simulation toolkit is started.
[TK 0000][2021-02-05 12:20:26][   0.000] No configuration file <steps_config.json> is found. Use default power system database capacity.
[TK 0000][2021-02-05 12:20:26][   0.000] STEPS simulation toolkit [TK 0000] @ 0XE4819490 is created.

Remarks

Since STEPS and stepspy are actively updated, please make sure use the latest version of both STEPS and stepspy. If you find something goes wrong after updating stepspy, go check if STEPS kernel is the latest version or not. Rebuid STEPS kernel and update the dynamic library can help fix the problem.
If you cannot find the proper kernel version, check the dev branch or contact maintainer.