Skip to main content

Using Virtual Environments (Venv) in Jupyter Notebooks

The Venv feature in Omnisient’s Jupyter Notebook makes it easy to create and manage isolated Python environments directly inside your notebook.

Omnisient Product avatar
Written by Omnisient Product
Updated yesterday

This allows you to install and use project-specific libraries without impacting other notebooks or shared environments.

This article is aimed at users working in Jupyter Notebooks who want a simple, repeatable way to manage dependencies.

What you need before you start

  • Access to Jupyter Notebook within the Omnisient platform

  • Permission to run notebooks in your project

  • Basic familiarity with Jupyter cells and magic commands


How the Venv feature works

The Venv feature is intentionally lightweight.
You only need two notebook cells to create and activate a virtual environment.

  • The first cell loads the Omnisient helper extension

  • The second cell creates and activates your virtual environment

The same command is used whether the environment already exists or not.


Step-by-step: Create and activate a virtual environment

Step 1: Load the Omnisient helper extension

In the first cell of your Jupyter Notebook, run:

%load_ext omni_helper

This enables Omnisient-specific helper commands in your notebook.


Step 2: Create and activate your virtual environment

In the second cell, run:

%omni_helper venv-activate venv
  • venv is the name of your virtual environment

  • You can replace it with any name, for example:

    • analysis_env

    • project_a_env

Example:

%omni_helper venv-activate analysis_env

What happens behind the scenes

  • First run

    • The environment is created

    • This can take up to 30 minutes, depending on setup and resources

  • Subsequent runs

    • The environment already exists

    • Activation is near-instant

You do not need separate commands for creation and activation—the same command handles both.


Best practices

  • Use clear, project-specific names for your environments

  • Keep the two commands at the top of your notebook so the environment is always ready before running code

  • Reuse the same environment across notebooks in the same project where possible


Troubleshooting

  • The command doesn’t run

    • Make sure %load_ext omni_helper is executed first

  • Long wait on first run

    • This is expected behaviour during initial environment creation

If issues persist, contact Omnisient Support via the Help Centre.


Conclusion

The Venv feature in Jupyter Notebook is designed to be simple and repeatable. With just two lines at the top of your notebook, you can create and activate a dedicated Python environment, ensuring clean dependency management and a smoother data preparation workflow on the Omnisient platform.

Did this answer your question?