Home

Awesome

Jupyter on Golem - Python Kernel

About

[!WARNING] At this time, further development of Jupyter on Golem project has been put on hold.

Jupyter on Golem is a Python kernel, which integrates with JupyterLab (https://jupyterlab.readthedocs.io) and enables it to run your Python Notebooks using resources available on decentralized Golem Network (https://www.golem.network/). Providers of such resources are compensated for their work with GLM tokens.

JupyterLab is an open-source project that is widely used by data scientists, analysts, researchers and developers. It allows you to create and share Notebooks - documents that combine code, equations, visualisations and narrative text. JupyterLab is part of Project Jupyter, umbrella project born from IPython Project (https://ipython.org/) and centered around providing tools for interactive computing with computational notebooks. Find more about Jupyter Project: https://jupyter.org/

Simplified view on JupyterLab:

Simplified Diagram of a JupyterLab flow

Simplified view on Jupyter on Golem:

Simplified Diagram of a Jupyter on Golem flow

Jupyter on Golem comes with following PyPI packages preinstallled:

Other packages can be installed on the Provider's host with %pip install command as described in Commands section of this document.

Prerequisites

Jupyter on Golem needs some prerequsites. Please make sure you have the following requirements pre-installed:

Installation

Install Jupyter on Golem package from PyPI:

pip install jupyter-on-golem

Add jupyter-on-golem to the list of known kernels:

python -m jupyter_on_golem install

Usage

Jupyter on Golem needs Yagna running on Your host to be able to talk with Golem Network. You can run it with single command (preferably in the separate Console Window):

yagna service run

With Yagna up and running You can start JupyterLab in standard fashion:

jupyter-lab

If installation process was completed correctly then Golem kernel should be visible and available in JupyterLab web interface:

Screenshot of a Golem kernel visible in JupyterLab web interface.

Click on the upper Golem icon (right under the Notebook section) to open new Notebook. You should be able to run Jupyter on Golem magic commands like %help ,which will display the most important information about Jupyter on Golem:

%help

Screenshot of a Golem help output in JupyterLab web interface.

When You finish using Jupyter on Golem You can close JupyterLab (File -> Shut Down) and press Ctrl+C in Yagna terminal window to turn it off.

Commands

Below You will find the list of all Jupter on Golem magic commands which are required to interact with this tool.

Magic commands is the concept of IPython (default kernel of JupyterLab). If you want to learn more then You should visit: https://ipython.readthedocs.io/en/stable/interactive/tutorial.html#magic-functions

%help

Shows Jupyter on Golem basic information and list of available magic commands with a short description.

%status

Shows the current status of Jupyter on Golem. With this command You can get following information:

%fund

Requests for Goerli testnet tokens: tGLM and tETH. You can only get Goerli testnet tokens this way.

%fund goerli

%budget

Allocates budget (GLM/tGLM) from funds in Your wallet for computation purposes on Jupter on Golem. It also sets the network to which you will connect when using %connect command! Using this command multiple times will each time overwrite the previous settings.

To setup for Goerli Testnet and Allocate 2 tGLM:

%budget goerli 1

To setup for Polygon Mainnet and Allocate 2 tGLM:

%budget polygon 2

%connect

Initialize a connection with a provider fulfilling specified requirements.

following requirements can be specified:

Please take into account that sometimes it might take a litle bit longer to find a provider and setup him for work. To define how much You are willing to wait You can use timeout parameter. Default timeout is set to 10 minutes (timeout=10m)

Sample connect command requesting for provider with at least 4GM of RAM, 10GB of Disk space and 2 CPU cores:

%connect mem>4 disk>10 cores>2

Sample connect command with timeout set to 15 minutes, requesting for provider with at least 4GM of RAM, 10GB of Disk space and 2 CPU cores:

%connect mem>4 disk>10 cores>2 timeout=15m

%disconnect

Disconnects from the current provider and initializes the payment transaction. It also shows following information:

%pip install

Installs specified pip package. It is imporant to do it as a magic command (with % prefix) for installation to be completed correctly!

For instance, to add some colors to Your notebook You can install colorama package:

%pip install colorama

Mainnet

To easily onboard yourself into Polygon Mainnet, You can use our "Onboarding Portal". However, please keep in mind that it is currently in the Technical Beta stage. Consequently, It should be functional but some issues migh still be present.

To use our "Onboarding Portal" You first need to identify Your Yagna Wallet Address. Fortunately it can be easily done with %status command run under Jupyter on Golem Notebook. Command will present You My wallet address value. Copy that value into clipboard and paste it into <PUT_HERE_YOUR_JUPYTER_ON_GOLEM_WALLET_ADDRESS> in the link below:

https://golemfactory.github.io/onboarding_production/?yagnaAddress=<PUT_HERE_YOUR_JUPYTER_ON_GOLEM_WALLET_ADDRESS>

As a result Your link should look simillarly to the one below:

DO NOT USE THIS LINK! THIS IS EXAMPLE ONLY! https://golemfactory.github.io/onboarding_production/?yagnaAddress=0x0000000000000000000000000000000000000000 DO NOT USE THIS LINK! THIS IS EXAMPLE ONLY!

Put the link with Your Jupyter on Golem wallet in Your browser address bar and follow the instructions presented there. To have minimal yet comfortable amount of tokens for trying out Golem Network it is recommended to spent around 10 EUR for Matic tokens and swap around 70% of them into GLM tokens. Onboarding Portal will help You out with that steps.

After the last step is completed, You should have Your GLM and Matic tokens on Yagna Wallet. You can verify that by running again %status command under Jupyter on Golem Notebook. Now You should be able to create allocation (e.g.%budget polygon 2) and connect to Mainnet Providers.

Examples

We have prepared some examples to help you play around with Jupyter on Golem and better feel what this solution is capable of. To run examples you need to import to Your JupyterLab following files:

Above examples are modification of "Linear Regression with a Real Dataset" Notebook from Machine Learning Crash Course created by Google: LINK. All exercises are made available under the Apache License Version 2.0

Data Set contains data drawn from the 1990 U.S. Census. It is also available as part of Machine Learning Crash Course created by Google: LINK. Tou can find data description HERE

Limitations

Jupyter on Golem is in its infancy stage. Consequently, it has many limitations You should be aware of. The most imporant are listed below:

Feedback

Did You try Jupyter on Golem? We would love to get to know your thoughts! Please give us your feedback HERE

Support

If you experience problems with Jupyter on Golem, You can try to get some help in the following places:

Known Issues

Below You will find list of known issues and potential solutions:

1. Unsuccessful funding on Goerli Testnet:

Sometimes after using %fund goerli command, You will get "Funding failed" output. It might happen due to delay between requesting tETH and tGLM by Jupyter on Golem. In most cases, it should be enough to just wait a few minutes. Afterwards, type %status command and You should be able to see that both tETH and tGLM have arrieved to Your wallet.

Terms and Conditions

By using Jupyter on Golem you agree to be bound by the terms described in Golem Network Disclaimer, User Interaction Guidelines and Privacy Policy.

Legal Statements

“Jupyter” and the Jupyter logos are trademarks or registered trademarks of NumFOCUS.