Environment (OS, Python version, PySpice version, simulator)
macOS, python3.12, PySpice 1.5
I'm trying to download PySpice on mac, using pip to install PySpice, and homebrew to install ngspice and libngspice. But, anytime I try to run a simulation — like with the following code — I get the following error.
Code:
circuit = Circuit('MyCircuit')
circuit.V('out', 'OUT', circuit.gnd, 13330)
circuit.PieceWiseLinearCurrentSource('in', circuit.gnd, 'IN', list(zip(t, q)))
for node in G.nodes:
n = G.nodes[node]
if n['kind'] in ('R', 'L', 'C'):
pals = list(nx.neighbors(G, node))
assert len(pals) == 2, node
pals = list(map(lambda x: circuit.gnd if x=='GND' else x, pals))
if n['kind'] == 'R':
circuit.R(node, *pals, n['R'])
if n['kind'] == 'C':
circuit.C(node, *pals, n['C'])
if n['kind'] == 'L':
circuit.L(node, *pals, n['L'])
sim = circuit.simulator()
res = sim.transient(step_time=1/fs, end_time=len(t)/fs)
Error:
OSError: cannot load library 'libngspice.dylib': dlopen(libngspice.dylib, 0x0002): tried: 'libngspice.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibngspice.dylib' (no such file), '/usr/lib/libngspice.dylib' (no such file, not in dyld cache), 'libngspice.dylib' (no such file), '/usr/lib/libngspice.dylib' (no such file, not in dyld cache). Additionally, ctypes.util.find_library() did not manage to locate a library called 'libngspice.dylib'
Please help!