Customize Your Environment Quickstart (CLI)

User Guide (Latest)

Use this documentation to learn how to customize your container environment by adding a package to your to NVIDIA AI Workbench project. For the full list of quickstarts, see Quickstart Guides.

The base container that you choose when you create your AI Workbench project might not have all the features that you need. You can customize your project by installing additional packages, customizing mounts, and defining new environment variables.

In this quickstart, you use the command line interface (CLI) to perform the following tasks:

  1. Start AI Workbench and open a project

  2. Customize your project by installing a package

  3. Rebuild your project environment

  4. Test by using your new package in code

Before you can complete the steps in this quickstart, you need the following:

  1. Open a command shell by doing one of the following:

    • On macOS or Ubuntu — Open a command shell.

    • On Windows — Open the WSL app by searching for WSL in your app list. When the WSL app opens, you should see a command prompt similar to the following:

      Copy
      Copied!
                  

      workbench@computer-name:~$

      Tip

      You can also use Terminal, Command Prompt, or Windows PowerShell, and access WSL by using the command wsl -d NVIDIA-Workbench.

  2. Check the available Locations (Contexts) on your computer by running the following command.

    Copy
    Copied!
                

    nvwb list contexts

    If you haven’t added any remote locations yet, the only available Location is the local computer. The output should look similar to the following.

    Copy
    Copied!
                

    NAME | DESCRIPTION | HOSTNAME | STATUS --------|-------------|-----------|--------------- local | My Computer | localhost | Not Running

  3. Run the following command to start the local Location.

    Copy
    Copied!
                

    nvwb activate local

    AI Workbench starts and connects to your computer, and (nvwb:local) now appears at the beginning of your command prompt.

  4. Run the following command to see the names and statuses of your projects.

    Copy
    Copied!
                

    nvwb list projects

  5. Run the following command to open your project. Change <your project name> to the name of your project.

    Copy
    Copied!
                

    nvwb open <your project name>

    AI Workbench opens your project, changes to the project directory, and (nvwb:local/<your project name>) now appears at the beginning of your command prompt.

Use the following procedure to add a package to your AI Workbench project.

  1. Run the following command to open JupyterLab.

    JupyterLab opens in your default browser ready for you to start working.

    Copy
    Copied!
                

    nvwb start jupyterlab

    JupyterLab opens in your default browser ready for you to start working.

  2. In JupyterLab, in the file browser, double-click requirements.txt to open it.

    The file opens and you should see an entry for jupyterlab.

  3. Move to the first empty line in the file, type numpy, and then save the file.

  4. In JupyterLab, choose File, and then click Shut Down. Confirm shut down and close the browser tab.

Whenever you change your project environment, you must rebuild the project before you can access the changes. Use the following procedure to rebuild your environment.

  1. In your command shell, check the status of your project by running the following command.

    Copy
    Copied!
                

    nvwb status

    You should see output similar to the following.

    Copy
    Copied!
                

    Name: test-cli-proj (/home/workbench/nvidia-workbench/test-cli-proj) Description: A hello world test project Environment: Full Build Required Container: Running Applications: jupyterlab: Stopped Remote Repository: https://github.com/nkmcalli/test-cli-proj.git (Up-to-date) Local Repository: 1 Modified

    Line 8 indicates that you changed your project by editing the requirements.txt file. Line 3 indicates that the changes you made require you to rebuild your project.

  2. Run the following command to stop your container environment. If the container is already stopped you see a message that the container is not running. Continue to the next step.

    Copy
    Copied!
                

    nvwb stop --container

  3. Run the following command to rebuild your project.

    Copy
    Copied!
                

    nvwb build

    The project builds. Wait until you see Container build complete and then go to the next section to test your new package.

  4. Run the following command to start your container environment.

    Copy
    Copied!
                

    nvwb start --container

After you add the package to your project and rebuild the container environment, you can use the new package in your code.

  1. To open JupyterLab, run the following command.

    JupyterLab opens in your default browser ready for you to start working.

    Copy
    Copied!
                

    nvwb start jupyterlab

  2. In JupyterLab, navigate to the code folder. If your project already has a notebook, click to open it. Otherwise; create a new notebook by choosing Python 3 (ipykernel).

  3. In your notebook, enter the following code and then click run.

    Copy
    Copied!
                

    import numpy as np

  4. Enter the following code and then click run.

    Copy
    Copied!
                

    print(np.e)

    You should see the following output which is the value of e.

    Copy
    Copied!
                

    2.718281828459045

  5. Save your notebook.

  6. In JupyterLab, choose File, and then click Shut Down. Confirm shut down and close the browser tab.

  7. In your command shell, run the following command to stop your project environment.

    Copy
    Copied!
                

    nvwb stop --container

Previous Customize Your Environment Quickstart
Next Hybrid RAG Advanced Walkthrough
© Copyright © 2024, NVIDIA Corporation. Last updated on Jun 10, 2024.