skip to content

Training materials

Tools and resources to assist using the AgReFed Platform.

How to ....

  • run shell command in Jupyter Notebook

    Shell commands can be run from within a notebook. Note that the available commands depend on your operating system. Assuming you are using the AgReFed platform, you will have access to unix bash commands.

    In a cell, type the magic function %%bash and on the next line(s), enter your command(s), same as you would in a terminal. This is useful if you need to install a new package without leaving the notebook. Simply run:

    pip install yourpackage

  • use git clone in a Jupyter Notebook

    If you want to get Jupyter notebook files (ipnyb) from GitHub within Jupyter, you can follow these steps:

    1. Copy the git clone directory from GitHub (select the HTTP protocol), which should have this format:
    2. In your Jupyter file browser, ensure that you are in your main working directory (probably "work" or similar)
    3. Click on the new launcher button (blue with plus sign), and click on the Python button below "Console" to open a console window
    4. At the bottom of the new console window, see the input area marked with "[]"
    5. Type the git clone command preceded with a bang and followed by the git directory you copied (in step 1), as follows: !git clone Then hit Shift-Enter or select Run, Run Cell from the menu.
    6. The output from the git clone process is shown in the console, and the Jupyter file brower will show the new directoryy created by git. The cloned files will be in this new directory. Any notebook files (ipnyb) can be run by double-clicking on them which will open a new window.
Back to Top