def _check_imports():
    """ Dynamically remove optimizers we don't have
    """

    optlist = ['ALPSO', 'CONMIN', 'FSQP', 'IPOPT', 'NLPQLP',
               'NSGA2', 'PSQP', 'SLSQP', 'SNOPT', 'NLPY_AUGLAG', 'NOMAD']

    for optimizer in optlist[:]:
        try:
            exec('from pyoptsparse import %s' % optimizer)
        except __HOLE__:
            optlist.remove(optimizer)

    return optlist
dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/drivers/pyoptsparse_driver.py/_check_imports