Skip to content

Installing packages and software in Gencove Explorer

Conceptually, it is useful to think about the environments you have access to via the Explorer platform in two parts:

  • Local environment, or the environment in which you interact with via your JupyterLab instance.
  • Cluster environment, or the environment to which you can submit Analysis work functions.

These are separate environments and they come with the same pre-installed packages by default.

New packages installed by the user in one environment do not propagate to the other automatically.

This is an important distinction; for example, just because you installed a Python module in your working environment via JupyterLab does not mean it is installed for use in the Analysis work function. In the following sections, we will take an example case where you have an analysis to run which requires a command line tool vcftools and a Python module cyvcf2, neither of which come pre-installed on Explorer instances or on the cluster, and provide details on how you would install this on both your Explorer instance and for your cluster analysis.

Explorer uses Conda as its primary package manager. It is used to install packages on both the local and cluster environment. The default Conda environment provided by Gencove is explorer, which is available in both the terminal and Jupyter notebooks.

💡 Advanced users may use Conda for managing separate environments for maintaining different versions of Python, R, and operating system tooling.

Updating Gencove packages

The gencove explorer update command (shorthand alias: u) can be used to update the Explorer SDK, Library, and Gencove CLI as follows:

$ u sdk      # Update Explorer SDK
$ u library  # Update Explorer Library
$ u cli      # Update Gencove CLI
$ u all      # Update all of the above

Installing packages in your Gencove Explorer working environment

Your Gencove Explorer instance is a Linux virtual machine running Ubuntu 22.04, and the JupyterLab instance runs on this machine. In our example, to install the vcftools Conda package from the bioconda channel, use the mamba command as follows:

$ mamba install -c bioconda vcftools

💡 We do not recommend using the system package manager (e.g., apt-get) to install packages, since they will not be available after the instance is restarted.

💡 We recommend using mamba because it resolves dependencies more effectively, but conda can be used as a drop-in replacement.

Similarly, you can install Python modules using pip; in our example, to install the cyvcf2 module, which also does not come preinstalled on Explorer instances, you would simply run

$ pip install cyvcf2

After this command successfully runs (and after you have restarted the iPython kernel), cyvcf2 will be installed in your local environment, and you will be able to use it in your Python notebooks on your Explorer instance.

Installing packages for use in Analysis work function

The cluster environment in which cluster jobs you submit are run is an entirely separate environment than your Explorer working environment, though it is also based on Ubuntu 22.04. As such, you must install software/modules explicitly when submitting jobs for analysis on the cluster (see documentation in Analysis).

The Analysis object accepts pip_packages, conda_packages, and image parameters to further assist with installing and using custom software.

Anaconda and PyPI packages can be installed either at the beginning of your work function:

from gencove_explorer.analysis import Analysis, AnalysisContext

def work(ac: AnalysisContext):
    # install necessary packages
    ! pip install cyvcf2
    ! mamba install -y -c bioconda vcftools
    # do actual analysis
    ...

or as parameters to the Analysis object:

from gencove_explorer.analysis import Analysis, AnalysisContext

an = Analysis(
    function=work,
    pip_packages=["cyvcf2"],
    conda_packages=["bioconda::vcftools"],
)
an.run()