Is there any way of restarting the kernel safely without losing things saved in Python Jupyter Notebook?

I can't import statsmodels.api in Jupyter Notebook anymore. I thought that it requires updating statsmodels.api. Then I typed "Conda update statsmodels.api". Then, the message comes up below.

PackageNotInstalledError: Package is not installed in prefix. prefix: XXX package name: statsmodels.api

Note: you may need to restart the kernel to use updated packages.

In order to update statsmodels.api, it seems that it would require restarting the kernel. But when trying to restart kernel, the warning came up as below.

"Do you want to restart the current kernel? All variables will be lost."

What does "all variable will be lost" mean? Will I lose all the things saved at Jupyter notebook? If so, how can I restart the Kernel safely without losing all the things I keep in my Jupyter notebook? 

1 Answer

Restarting your kernel will reset your Jupyter notebook and remove all variables or methods you have defined.

You will not lose the code written by you. Just that, you have to run all the code cell again to set the variables and methods.

OR,

You can do "Restart & Run All" It will show the message-- Are you sure you want to restart the current kernel and re-execute the whole notebook? All variables and outputs will be lost.

However, after selecting the above option, all the variables and methods will be set again. You don't have to manually execute all the code cells.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like