Skip to main content

Installing pip packages

Nebari is supported by conda-store for environment management. Although all environments in Nebari are - at their core - conda environments, it is still possible to install packages via pip.

In this document we'll cover some common usecases. Please refer to the pip VCS Support documentation for additional usecases.

Also note that conda-store does not have the ability to pick up your SSH keys so all references must be Open Source or utilize PATs (see examples below)

đŸ”Ĩwarning

Mixing pip and conda can result in conflicts at runtime. It is best to avoid this.

If you really must, then continue reading.

Why can't I just use pip install from command line?​

Nebari prohibits the standard local installation of packages, e.g. pip install .... On your personal computer, when you pip install a package into a conda environment, it will be placed inside of the conda environment folder structure. However, on Nebari, the environments are managed by conda-store in a directory structure which is read-only to users.

For this reason, all pip installs would instead default to the user's .local directory. Unfortunately, all environments will automatically pick up everything has been installed in this directory. It is extremely easy to create a situation in which all environments are broken due to a conflict. In fact, its possible to create a situation that causes a user's JupyterLab server to be unable to start. For this reason, local pip installs are prohibited in Nebari.

ℹī¸note

For more information on developing local packages, check out the docs on developing packages on Nebari.

Installing packages published on pypi.org​

To install packages which are published on pypi.org, you can create an environment in conda-store as you typically would [link] but add additional section for pip. Let's use ragna as an example:

channels:
- conda-forge
dependencies:
- python=3.12
- pip
- pip:
- ragna

Installing packages from an Open Source git repo​

To install packages from an Open Source repository, you can use the http syntax. Its important to note that a tag or hash is required. Without it, git will attempt to install the master branch and will likely fail since most projects have moved away from this convention in favor of main.

channels:
- conda-forge
dependencies:
- python=3.11
- pip:
- ragna @ git+https://github.com/Quansight/ragna.git@v0.2.1

Installing packages from a private GitHub repository​

To install a packages from a private repository on GitHub, you'll first need to create a Personal Access Token (PAT). Please be aware that this token will be visible to anyone with access to the environment so it is best to delete the token immediately after environment creation. We suggest limiting the scope of the PAT to read-only access to the contents for a single repository.

For this example, let's suppose your GitHub user is named username and the PAT generated by GitHub is github_pat_asdf. We will assume the repo is located at https://github.com/username/reponame and we want to grab the main branch.

channels:
- conda-forge
dependencies:
- python=3.11
- pip
- pip:
- greatpackage @git+https://github_pat_asdf@github.com/username/reponame.git@main

Installing packages from a private GitLab repository​

To install a package from a private repository on GitLab, you'll first need to create a PAT in order to access the repo. Please be aware that this token will be visible to anyone with access to the environment so it is best to delete the token immediately after environment creation.

In this example, let's suppose your GitLab user is named username and the PAT generated by GitLab is glpat-asdf. We will assume the repo is located at https://gitlab.domain.net/teamname/projectname/reponame, the package gets installed as greatpackage, and we want to grab the 0.7.0 release. Your GitLab repo may have more or less team/project embedding, but this is just one example.

channels:
- conda-forge
dependencies:
- python=3.11
- pip
- pip:
- greatpackage @
git+https://username:glpat-asdf@gitlab.domain.net/teamname/projectname/reponame.git@0.7.0

Conclusion​

Now that you've seen several examples of installing pip packages in conda-store, you can go try it out on your own packages!

To learn more about using a "dev" install of local pip package for active development, check out the documentation on installing a development package.