Skip to main content
Skip table of contents

Installing Python Modules and Packages

Seeq Data Lab provides a controlled environment to ensure stability and security for your projects. Users do not have sudo privileges within Data Lab projects, and therefore cannot use typical package managers like apt-get or yum to install OS packages.

Overview

Python packages found in the public PyPi repository can be installed to the current Data Lab project or globally for all projects either directly in a notebook or a Data lab terminal. See Preinstalled Packages for a list of preinstalled packages.

Installing Packages

Installing Packages From a Notebook

Install a package for the the current Python kernel from within a notebook by using the following command in a notebook code cell. Note the exclamation point prefixing the pip command.

CODE
!pip install <package>

You must restart the kernel after installing the package in a notebook for the package to be imported when referenced in a notebook cell. Restart the kernel by clicking on the menu Kernel > Restart (It is a common mistake to forget!)

If the installation fails to complete, please check the requirements for the specific Python package to ensure they are met for the current Python environment and the currently installed packages.

To learn how to change the Python version of the kernel, see Python Versions and Packages | Switch-Versions-Within-Your-Notebook.

Installing Packages From a Terminal

When installing, uninstalling or listing Python packages, it’s often more convenient to use a terminal. You can launch a terminal by clicking on the menu New > Terminal. Once you’re inside the terminal, you don’t have to precede the commands with an exclamation point.

CODE
pip install <package>

Make sure to restart the kernel of any open notebooks after the package has been installed through the terminal.

To learn how to change the Python environment in the terminal, see Python Versions and Packages | Switch-Version-Within-Terminal.

Some modules are preinstalled in Data Lab. For example, Pandas and NumPy are always available and you can inspect the version by executing:

CODE
pip show <package_name>
image-20260318-010712.png

Packages that are specific to your project are installed to the ~/.local/lib/pythonX.YY/site-packages folder. Where X.YY is the Python version being used. Sometimes pip will have trouble installing or uninstalling a package and leave you in a bad state. You can always cd to this folder and use rm -rf <folder_name> to manually remove packages.

Installing Packages Globally (to All Projects)

Admins can install Python packages globally for use in all projects by installing the package into the folder /seeq/python/global-packages (or use the environment variable $GLOBAL_PKG). The preferred way to do this is to set the PYTHONUSERBASE environment variable to this folder as a prefix to the pip install command.

CODE
PYTHONUSERBASE=$GLOBAL_PKG pip install <package>

Make sure to restart the kernel of any open notebooks after the package has been installed through the terminal.

To uninstall a global package:

CODE
PYTHONUSERBASE=$GLOBAL_PKG pip uninstall <package>

Note that all pip commands intended to reference or include global packages must also use PYTHONUSERBASE=$GLOBAL_PKG as a prefix before the desired pip command.

Overriding Preinstalled Packages

If you want to upgrade or downgrade a preinstalled packages to a specific version, you can do so by pinning the package version in the pip install command:

CODE
pip install pandas==2.0.0

If you want to upgrade or downgrade a preinstalled packages to the latest version, you can do so by pinning the package version in the pip install command:

CODE
pip install -U pandas

Installing a local version of a preinstalled package will override the built-in version for this project only and this version will remain even if Data Lab is upgraded.

You can choose to revert to the built-in version of by uninstalling the local version:

CODE
pip uninstall -y pandas

Locking Versions of Preinstalled Package

Seeq Data Lab does not support the use of virtual environments within a project.

To provide the latest bug fixes and security updates of preinstalled packages, their versions may be upgraded in any Seeq release. If you wish to lock down the version of a preinstalled package and its dependencies, you can force reinstall it locally, even if it is the same version as the preinstalled package, by including the -force-reinstall flag:

CODE
pip install --force-reinstall pandas

If you also want to force install the dependencies of a package, include the --upgrade-strategy eager setting:

CODE
pip install --force-reinstall --upgrade --upgrade-strategy eager pandas

If your code depends on locked package versions and you are concerned about unexpected installations or upgrades, consider adding a safety check to your notebook or module code by asserting the expected versions:

CODE
import numpy as np
from packaging.version import Version

assert Version(np.__version__) == Version("2.4.2"), \
    f"Expected NumPy 2.4.2, got {np.__version__}"

Upgrading SPy

The SPy module is packaged as seeq-spy, and you can easily upgrade it by issuing the following command:

CODE
pip install -U seeq-spy

This will override the preinstalled SPy version for this project only and this version will remain even if Data Lab is upgraded.

You can choose to revert to the built-in version of SPy by uninstalling the local version:

CODE
pip uninstall -y seeq-spy

Order of Precedence for Importing Python Packages

Data Lab has 3 locations for Python packages with each location having a different priority when imported by a notebook’s kernel.

  1. Local: User installed packages into the current Data Lab project have the highest priority when a notebook attempts to import a package or module.

  2. Global: Admins who have installed packages globally for all projects to access have the next priority level when a notebook attempts to import a package or module.

  3. System: Preinstalled packages have the lowest priority when a notebook attempts to import a package or module.

Installing JupyterLab Extensions

Data Lab’s Advanced Mode is built on JupyterLab, and there are many useful extensions that the community has developed. Only extensions distributed as a Python package are supported. Extensions can be installed either locally to a particular project or globally installed for all projects. Data lab natively supports Jupyter “lab” extensions which adds additional user interface capabilities to JupyterLab.

Data Lab also supports Jupyter “server” extensions which add backend Jupyter capabilities. However, as of Seeq releases dated March 22, 2025, a project must be configured to enable user-installed server extensions. Pre-installed server extensions require no additional action as they are always imported upon project startup. To enable user-installed Jupyter server extensions for a project:

  • Open the Help Center from the hamburger menu on the Seeq header.

  • Select the API Reference option.

  • Expand the Projects section and the POST /projects{id} API endpoint.

  • Set the startupEnvironmentfield to the desired Python environment, such as python311. Note that you must also the name field as well.

  • Click Execute

  • Confirm in the response that the startupEnvironmentfield reflects the correct value.

The default value is system which starts the project without importing user-installed Jupyter sever extensions. Note that python38 is not a supported Python environment for user-installed Jupyter server extensions. Once a server extension is installed, you must restart the project for Data Lab to run the server components. You can do so by clicking the Quit button in the Data Lab header to shut down the project. Once you reopen the project, the server components will load on startup.

Sharing Configuration Across Projects Using pip.conf

To share pip configuration across all Data Lab projects, admins can create and configure a "pip.conf" file in the /seeq/python/global-packages/.config folder.

Here is an example pip.conf file:

CODE
[install]
extra-index-url = https://pypi.example.com
trusted-host = pypi.example.com

Pip config files also support a list of extra and trusted URLs. For more information, refer to the official documentation.

Installing Packages from a Private Repository

For private repository configuration, admins can also create a file “.netrc” with credentials in the /seeq/python/global-packages/.config folder. This will enable users to download packages without entering credentials.

Here is an example .netrc file:

CODE
machine pypi.example.com
    login your_pipy_example_com_login
    password your_pipy_example_com_password
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.