Does changing the notebook accelerator persist custom pip installations across kernel restarts?
0 reputation · 27 Oct 2023, 21:52 UTC
Kaggle Notebooks allow users to switch between CPU, GPU, and TPU accelerators via the settings pane. This transition triggers a full kernel restart to reallocate the underlying hardware resources.
While files written to the /kaggle/working directory are preserved during a kernel restart, the state of the Python environment is volatile. Specifically, there is uncertainty regarding whether packages installed via pip during a session remain available after the environment switches accelerators, or if the container is fully reset to the base image.
What is the expected behavior for runtime-installed libraries when transitioning from a CPU to a GPU environment? Does the session maintain the installed package state, or must the installation process be repeated after the accelerator change?