void (final Sdk sdk) { ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> { final LibraryTable.ModifiableModel libraryTableModel = ModifiableModelsProvider.getInstance().getLibraryTableModifiableModel(); final Library library = libraryTableModel.getLibraryByName(PythonFacetUtil.getFacetLibraryName(sdk.getName())); if (library != null) { libraryTableModel.removeLibrary(library); } libraryTableModel.commit(); }), ModalityState.nonModal()); }