-
Notifications
You must be signed in to change notification settings - Fork 80
JupyterLab on Scalingo #3548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
JupyterLab on Scalingo #3548
Changes from 1 commit
b02d79c
253cb5f
9a59a0a
be5d2af
151cfa0
360e674
e8cb9dd
26524e7
5c6b636
6ae04ff
46ea783
e6cca38
10343b2
145c730
5f2a9fc
180870b
8b8a0fc
37b1e84
395b0c7
df76791
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,200 @@ | ||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||
| title: Getting Started with Jupyter Notebook on Scalingo | ||||||||||||||||||||||||||||||
| modified_at: 2025-11-25 12:00:00 | ||||||||||||||||||||||||||||||
| tags: tutorial jupyter notebook | ||||||||||||||||||||||||||||||
| index: 14 | ||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Jupyter Notebook is an open-source web application that allows you to create | ||||||||||||||||||||||||||||||
| and share documents containing live code, equations, visualizations, and | ||||||||||||||||||||||||||||||
| narrative text. | ||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
|
||||||||||||||||||||||||||||||
| ## Planning your Deployment | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
|
||||||||||||||||||||||||||||||
| By default, Jupyter Notebook stores notebooks on the local filesystem. Since | ||||||||||||||||||||||||||||||
| Scalingo's filesystem is ephemeral, you'll have to provision a | ||||||||||||||||||||||||||||||
| [Scalingo for PostgreSQL®][db-postgresql] addon to persist your notebooks. We | ||||||||||||||||||||||||||||||
| usually advise to start with a Scalingo for PostgreSQL® Starter 512 addon, and | ||||||||||||||||||||||||||||||
| upgrade to a more powerful plan later if need be. | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest to add the information you initially put at the end of the page here, like so:
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Depending on several factors such as the size of your datasets, the complexity | ||||||||||||||||||||||||||||||
| of your computations, and the number of notebooks you run at the same time, | ||||||||||||||||||||||||||||||
| Jupyter Notebook can consume a lot of RAM. | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Deploying | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| ### Using the Command Line | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| We maintain a repository called [jupyter-notebook-persistence][jupyter-notebook-persistence] | ||||||||||||||||||||||||||||||
| on GitHub to help you deploy Jupyter Notebook on Scalingo. Here are the few | ||||||||||||||||||||||||||||||
| additional steps you will need to follow: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| 1. Clone our repository: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| git clone https://github.com/Amyti/jupyter-notebook-persistence | ||||||||||||||||||||||||||||||
|
Frzk marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| cd jupyter-notebook-persistence | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| 2. Create the application on Scalingo: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| scalingo create my-jupyter | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Notice that our Command Line automatically detects the git repository, and | ||||||||||||||||||||||||||||||
| adds a git remote to Scalingo: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| git remote -v | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| origin https://github.com/Scalingo/jupyter-scalingo (fetch) | ||||||||||||||||||||||||||||||
| origin https://github.com/Scalingo/jupyter-scalingo (push) | ||||||||||||||||||||||||||||||
| scalingo git@ssh.osc-fr1.scalingo.com:my-jupyter.git (fetch) | ||||||||||||||||||||||||||||||
| scalingo git@ssh.osc-fr1.scalingo.com:my-jupyter.git (push) | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| 3. Provision a Scalingo for PostgreSQL® Starter 512 addon: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| scalingo --app my-jupyter addons-add postgresql postgresql-starter-512 | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| 4. (optional) Instruct the platform to run the `web` process type in a single | ||||||||||||||||||||||||||||||
| L container: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| scalingo --app my-jupyter scale web:1:L | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| 5. Set a **mandatory** environment variables: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Set the password to access Jupyter Notebook: | ||||||||||||||||||||||||||||||
|
Comment on lines
+75
to
+77
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| scalingo --app my-jupyter env-set JUPYTER_NOTEBOOK_PASSWORD=<YOUR_SECURE_PASSWORD> | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| 6. Everything's ready, deploy to Scalingo: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| git push scalingo main | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Updating | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| Jupyter Notebook is a Python application, distributed via its own package | ||||||||||||||||||||||||||||||
| called `jupyter`. Updating to a newer version mainly consists in updating your | ||||||||||||||||||||||||||||||
| requirements in the `requirements.txt` file of your Jupyter repository. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| 1. In your Jupyter repository, update the `requirements.txt` file with the | ||||||||||||||||||||||||||||||
| desired version: | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| jupyter==<NEW_VERSION> | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| 2. Commit the update: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| git add requirements.txt | ||||||||||||||||||||||||||||||
| git commit -m "Upgrade to Jupyter <NEW_VERSION>" | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| ### Using the Command Line | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| - Make sure you've successfully followed the first steps | ||||||||||||||||||||||||||||||
| - Push the changes to Scalingo: | ||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||
| git push scalingo main | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Customizing | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| ### Environment | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| Jupyter Notebook supports several environment variables to customize its | ||||||||||||||||||||||||||||||
| behavior. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Moreover, the deployment makes use of the following environment variable(s). | ||||||||||||||||||||||||||||||
| They can be leveraged to customize your deployment: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **`SCALINGO_UID`**\\ | ||||||||||||||||||||||||||||||
| This variable will set your UID for your scalingo postgresql account. | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We try to avoid future when not necessary:
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **`JUPYTER_NOTEBOOK_PASSWORD`** \\ | ||||||||||||||||||||||||||||||
| Sets the password to access the Jupyter Notebook interface. | ||||||||||||||||||||||||||||||
| Jupyter Notebook will start if this variable is not set, you just have to enter your token. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **`JUPYTER_TOKEN`**(mandatory)\\ | ||||||||||||||||||||||||||||||
| Sets the token to access the Jupyter Notebook interface.\\ | ||||||||||||||||||||||||||||||
| Jupyter Notebook will not start if this variable is not set. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - **`DATABASE_URL`** (automatically set)\\ | ||||||||||||||||||||||||||||||
| This variable is automatically set when you provision a Scalingo for | ||||||||||||||||||||||||||||||
| PostgreSQL® addon. It is used to store notebooks persistently in the | ||||||||||||||||||||||||||||||
| database. | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We really don't want user to mess with this one ^^
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| ### Installing Additional Python Packages | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| To install additional Python packages, add them to the `requirements.txt` file | ||||||||||||||||||||||||||||||
| at the root of your repository: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
| jupyter | ||||||||||||||||||||||||||||||
| numpy | ||||||||||||||||||||||||||||||
| pandas | ||||||||||||||||||||||||||||||
| matplotlib | ||||||||||||||||||||||||||||||
| scikit-learn | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Then, commit and push your changes to trigger a new deployment. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ### Object Storage (Outscale) – Optional | ||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| If you want to store large files or share notebooks across multiple projects, it is **possible** to use an external S3-compatible object storage, such as Outscale Object Storage. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| > ⚠️ Note: By default, JupyterLab uses **pgcontents** with PostgreSQL to persist notebooks. Using S3 storage is **entirely optional**. PostgreSQL is sufficient for most use cases on Scalingo. | ||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| For reference and further details about using S3 storage with JupyterLab, you can check out the [S3ContentsManager documentation](https://github.com/cloudbutton/s3contents). | ||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| No implementation is required to use PostgreSQL — this section is informational only. | ||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ## Persistent Storage | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| By default, notebooks are stored in a PostgreSQL database to ensure persistence | ||||||||||||||||||||||||||||||
| across container restarts and redeployments. This is achieved using | ||||||||||||||||||||||||||||||
| [pgcontents][pgcontents], a Postgres-backed storage system for Jupyter. | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| This means: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| - Notebooks survive application restarts | ||||||||||||||||||||||||||||||
| - Notebooks benefit from Scalingo's automated database backups | ||||||||||||||||||||||||||||||
| - No data loss due to Scalingo's ephemeral filesystem | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest to remove this in favor of further explanations at the beginning of the page.
Suggested change
|
||||||||||||||||||||||||||||||
| [jupyter-notebook-persistence]: https://github.com/Amyti/jupyter-notebook-persistence | ||||||||||||||||||||||||||||||
| [pgcontents]: https://github.com/quantopian/pgcontents | ||||||||||||||||||||||||||||||
| [db-postgresql]: https://doc.scalingo.com/databases/postgresql/getting-started/provisioning | ||||||||||||||||||||||||||||||
|
Amyti marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||
| [dashboard]: https://dashboard.scalingo.com/apps/ | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.