Skip to main content
Skip table of contents

Installing Python Modules

External Python modules that are needed by the end user can be installed to the Seeq Data Lab project with the standard Python module instructions.

See Preinstalled Packages for a list of preinstalled packages and our recommendation to use them.

From a Notebook Cell

CODE
!pip install <package>

You must do Kernel > Shutdown and then Kernel > Restart the notebook’s kernel after installation. (It is a common mistake to forget!)

If the installation fails to complete, please check the requirements for the specific python module package to ensure all requirements are met by the Seeq Data Lab server and/or project.

From the Terminal

When installing, uninstalling or inspecting the Python package environment, it’s often more convenient to use a Jupyter Terminal. You can launch a terminal from the Jupyter Home Page by selecting New > Terminal. Once you’re inside the terminal, you don’t have to precede the commands with an exclamation point.

Some modules are “built-in” to Data Lab. For example, Pandas and NumPy are always available and you can inspect the version by doing:

CODE
pip show <package_name>

You can upgrade or downgrade these packages to a specific version. For example:

CODE
pip install pandas==1.1.3

It is best to ensure that no Python kernels are running as you are adding removing packages. You can see the running kernels by clicking on the Running tab on the Jupyter Home Page. You can shut everything down from there.

Packages that are specific to your project and installed to the ~/.local/lib/python3.7/site-packages folder. 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.

Upgrading SPy

Make sure to check whether you are running against R60 (or later) or R59 (or earlier) before picking which set of instructions to follow.

R60 and later

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 command will override the built-in version for this project only and this version will remain even if Seeq Data Lab is upgraded. You can choose to revert to the built-in version of SPy by doing the following:

CODE
pip uninstall -y seeq-spy
R59 and earlier

The seeq module, which includes SPy, is also built-in. However, a new functional version may be available on PyPI that you wish to utilize. You can upgrade by executing the following command:

CODE
pip install -U seeq~=<major_version>.<minor_version>

Where <major_version> and <minor_version> correspond to the version numbers for Seeq Server / Seeq Data Lab.

This command will override the built-in version for this project only and this version will remain even if Seeq Data Lab is upgraded. Thus, you may need to issue the above command again if the major_version changes.

You can also choose to revert to the built-in version of SPy by doing the following:

CODE
pip uninstall -y seeq

Installing Packages Globally (to All Projects)

Admins can install Python modules for use in all projects by installing external packages into the folder /seeq/python/global-packages. The preferred way to do this is to use PYTHONUSERBASE:

CODE
export PYTHONUSERBASE=/seeq/python/global-packages 
pip install <package>

Make sure to restart the kernel after installation.

Python packages that are installed to /seeq/python/global-packages will be overridden by packages installed to ~/.local/lib/python3.7/site-packages.

To uninstall a global package:

CODE
export PYTHONUSERBASE=/seeq/python/global-packages 
pip uninstall <package>

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

CODE
export PYTHONUSERBASE=/seeq/python/global-packages 
pip show <package>
pip list

Jupyter Extensions

Admins can install Jupyter nbextensions for all projects. All notebooks configured to search for extensions in /seeq/python/global-packages folder. The preferred way to install nbextension to this folder is to use JUPYTER_CONFIG_DIR and JUPYTER_DATA_DIR.

CODE
# setup folder for Jupyter to install extension
export JUPYTER_CONFIG_DIR=/seeq/python/global-packages
export JUPYTER_DATA_DIR=/seeq/python/global-packages

# install nbextension in standard way
jupyter nbextension install --user --symlink --overwrite --py <package>
jupyter nbextension enable --user --py <package>

Make sure to restart the kernel after installation.

Note that the safest way is to install nbextensions for all projects from packages available for all projects.

Note that exporting environment variables will affect your current terminal session. So if you need to install Project-specific packages after packages were installed globally then you need to unset PYTHONUSERBASE

Shared “pip.conf” file

To share pip configuration across all SDL 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.

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.