pyngspice is a Python binding for the circuit simulator Ngspice, enabling seamless integration of Ngspice simulations within Python scripts. This project draws significant inspiration from PySpice but aims for faster performance by leveraging Python’s C extension capabilities.
Before installing, you need to set up Ngspice on your system.
- Download the latest Ngspice DLL package from this link.
- Extract the downloaded file and rename the
Spice64_dllfolder toSpice64. - Move the
Spice64folder to theC:\\directory.
For Debian-based distributions (e.g., Ubuntu):
sudo apt install libngspice0-dev ngspiceFor Fedora-based distributions:
sudo dnf install libngspice-devel ngspice-codemodel(Note: The Fedora-based installation has not yet been tested.)
For macOS users, Ngspice can be installed using Homebrew:
brew install ngspiceFor those requiring multithreading support of Ngspice, you can install the OpenMP version using the following script (supported on Linux and macOS):
curl -sSL https://raw.githubusercontent.com/LeunPark/pyngspice/main/scripts/install-ngspice-omp.sh | bash -Once Ngspice is installed, you can proceed to install pyngspice:
pip install git+https://github.com/LeunPark/pyngspice.gitIf you encounter errors related to pkg-config during installation, you may need to install it separately.
import pyngspice