Trouble with Libraries

Hello!

To better understand PySpice, I’m working through a very simple circuit involving a voltage source, a resistor, and a 1N4148 Diode. However, I am having trouble with Python recognizing the library I need to bring in the characteristics of the diode. Here is my code:

'import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()

from PySpice.Doc.ExampleTools import find_libraries
from PySpice.Spice.Netlist import Circuit
from PySpice.Spice.Library import SpiceLibrary
from PySpice.Unit import *
from PySpice.Physics.SemiConductor import ShockleyDiode

libraries_path = find_libraries()
spice_library = SpiceLibrary(libraries_path)

circuit = Circuit(‘Diode Characteristic Curve’)

circuit.include(spice_library[‘1N4148’])

circuit.V(‘input’, ‘in’, circuit.gnd, 10@u_V)
circuit.R(1, ‘in’, ‘out’, 1@u_Ω) # not required for simulation
circuit.X(‘D1’, ‘1N4148’, ‘out’, circuit.gnd)’

And here is my result:

--------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-5-ae802129d891> in <module> 20 circuit = Circuit('Diode Characteristic Curve') 21 ---> 22 circuit.include(spice_library['1N4148']) 23 24 circuit.V('input', 'in', circuit.gnd, 10@u_V) /usr/local/lib/python3.8/dist-packages/PySpice/Spice/Library.py in __getitem__(self, name) 105 # print('Library {} not found in {}'.format(name, self._directory)) 106 # self._logger.warn('Library {} not found in {}'.format(name, self._directory)) --> 107 raise KeyError(name) 108 109 ############################################## KeyError: '1N4148'

Can anyone help me understand what exactly is going wrong here and how I can correct it?

Thanks!