Skip to main content
Skip table of contents

Installing Python Modules

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

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.

Installing Packages From a Notebook Cell

Packages can then directly be installed from the notebook cell for the selected Python kernel ( see Switch Python Versions )

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.

Switch Python Versions Within Your Notebook:

Seeq Data Lab provides a user-friendly way to switch Python versions within your notebook. Simply navigate to the kernels dropdown menu situated in the top right corner of your notebook (1). This will open a dropdown that list the available Python versions to select from (2). The Python version you choose for a particular notebook cell is automatically persisted after execution. This eliminates the need to repeatedly select the version for each cell within the same notebook.

The Python version for the notebook is only saved after executing a cell in the notebook.

image-20240327-210106.png

Installing Packages 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.

Changing Python Versions

The pyversion command empowers you to manage Python versions directly from the terminal. To switch to Python 3.11, simply execute the command pyversion 3.11. This ensures that subsequent package installations using pip install target the newly selected Python version (3.11 in this case).

image-20240327-210357.png

The python version is depicted between parentheses, “(pyX.Y.Z)”, in the command line and will Initially defaults to the platform's default Python version, which will be 3.8 until the October 2024 update. In the example above you can see that the version is py3.8.18

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/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.

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 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

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 any packages installed locally.

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

Installing JupyterLab Extensions

Seeq Data Lab’s Advanced Mode is built on JupyterLab, and there are many useful extensions that the community has developed. Extensions can be added on a per-project basis. Taking the example of Tabnine, a popular code auto-complete extension, installation can be accomplished as follows:

  1. Launch the Data Lab project to which you wish to add the extension.

  2. Make sure you are in Advanced Mode (JupyterLab).

  3. Launch a Terminal tab.

  4. Execute the installation instructions. In the case of Tabnine, those instructions are pip install jupyterlab_tabnine.

  5. Enable the extension by executing jupyter server extension enable --user jupyterlab_tabnine.

  6. Look for any errors in the output of the command to make sure it was successful.

  7. Click the Quit button in the Seeq Data Lab header to shut down the project.

  8. Re-launch the project from Seeq’s home screen.

  9. Switch back to Advanced Mode if necessary.

  10. Test the extension. In the case of Tabnine, it will pop up auto-complete suggestions as you type in code cells:

There is currently no method to add a JupyterLab extension for all projects at once.

Sharing Configuration Across Projects Using pip.conf

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.