How to fix pyspice OSError: cannot load library ‘’


When trying to run a PySpice program, you see an error message such as

OSError: cannot load library '': cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called ''


Install libngspice, often called libngspice0.

On Ubuntu, install it using

sudo apt -y install libngspice0-dev

You need to install the -dev library since libngspice0 only contains whereas the -dev library contains which is required by pyspice.