Run your Jupyter Notebook in the cloud in less than 5 minutes using 3 very easy steps
ver wanted to move your locally developed Jupyter Notebook to run in the cloud? Fed up with managing your own infrastructure? Need to run a Jupyter Notebook regularly? In this short article I will show you how to schedule and run your Notebook in the cloud. It should not take you more than 5 minutes once you have your Notebook all set up
I am going to use www.nbfire.io to run my notebook and for the sake of simplicity use their example notebook that you can find at the top of the page at www.nbfire.io/documentation. However, you could use any notebook as long as it has been updated to run in the cloud which I will cover next.
First, you need do two things to adapt your notebook.
Ensure that any python packages that you are using locally are stored in your notebook. The example notebook requires two packages to run Matplotlib and Pandas, so we can install them by adding a cell to the top of the notebook with the commands
!pip install Matplotlib
!pip install Pandas
Set up any parameters (as strings) that you want to inject into your notebook when it runs. Using parameters makes your notebooks easy to re-use.
领英推荐
Create a cell near the top of your notebook and then choose View > Cell Toolbar > Tags and then enter ‘parameters’ as the tag for cell you created. The example notebook takes two parameters, API_KEY and LOCATION. We specify the parameters names in the cell and then add values for them in the next step.
Second, upload your notebook to www.nbfire.io. Create a FREE account and then select Notebooks>Add from the navbar.
Choose the Notebook you want to schedule and then enter values for the parameters you specified in the previous step. In the video below you can see how to enter a value for the API_KEY and LOCATION. By default the schedule is automatically set via CRON (UTC) to run every hour or you can create your own schedule to suit your needs. Clicking on ‘FIRE SCHEDULE’ enables your Notebook runs.
Third, your Notebook is now running in the Cloud to the schedule you specified. You can download an output Notebook for run to review your analysis.
Congratulations!