I have a Jupyter noteboook and I\'m trying to set it up in a way so that all cells are ran automatically when the notebook is opened.
This behaviour is different from
I don't believe this is possible.
ipython does not execute code unless it is 1) intentional and 2) trusted. Otherwise you'll run into situations where you load up notebooks that contain malicious code.
You can check details of ipythons security model here: https://ipython.org/ipython-doc/dev/notebook/security.html . Specifically the section that talks about code execution upon notebook opening: "The security problem we need to solve is that no code should execute just because a user has opened a notebook that they did not write"
While you can set explicit trust on a notebook, I'm not sure if this will then also allow automatic code execution as well. I haven't seen anything of the sort, but maybe I just haven't been looking hard enough. I've seen elsewhere that automatic code execution isn't something that's available in the core ipython package though. Check this issue here: https://github.com/ivanov/ipython-trainingwheels/issues/35
Beyond trust, another reason I suspect this isn't possible is because 1) automatic code execution will replace any existing output that is currently saved in the notebook, which may not be ideal, and 2) some notebooks may contain complex code that is computationally expensive, which you wouldn't want to be running every time you opened the notebook.