saurabh18cs
Honored Contributor III

maybe you can add some time between uninstalling of libraries and restart

uninstall_libraries()
time.sleep(60)  # Wait for the libraries to be uninstalled
restart_cluster()