Skip to content

Commit 8ba8a5a

Browse files
authored
Merge pull request #399 from pavithraes/conda-store-docs
Update conda-store docs
2 parents 32d1344 + 4a376e4 commit 8ba8a5a

9 files changed

+75
-139
lines changed
Lines changed: 75 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,181 +1,117 @@
11
---
22
id: creating-new-environments
3-
title: Creating a new environment on Nebari
4-
description: Using conda-store for environment creation
3+
title: Manage packages and environments
4+
description: Using conda-store for environment management
55
---
66

7-
## Introduction
7+
Nebari uses [`conda-store`][conda-store-docs] for managing and sharing reproducible
8+
environments (collection of specific packages and versions) on the platform.
89

9-
In this tutorial, you will learn how to create a new environment on Nebari using `conda-store`,
10-
install new `conda` packages in your environment, manage multiple environments, and also share the environment with other Nebari users.
10+
:::warning
11+
conda-store is the most reliable way to manage your packages and environments on
12+
Nebari.
1113

12-
### Why using `conda` environments
13-
14-
Development environments give developers and Data Scientists a "sandbox" to work in, experiment with new packages, work across multiple projects, and collaborate with their peers.
15-
Environment and package managers such as `conda` enable you to create isolated spaces to separate dependencies on a per-project basis.
16-
They also add other benefits such as:
17-
18-
- Reduce friction to install and upgrade dependencies without affecting other projects or users
19-
- Reduce the risk of dependency conflicts
20-
- Promote reproducibility and replicability through dependency pinning
21-
- Reduce the "works on my machine" risk - thus working towards reproducible builds across multiple machines
22-
23-
### What is `conda`?
24-
25-
[Conda](https://docs.conda.io/projects/conda) is an open source package management system that allows you to create
26-
environments and install packages into them. It allows the creators of a package to specify required dependencies
27-
which `conda` can then solve into an environment. `Conda` can then run an update on the environment to pull all the
28-
latest versions of the packages while still maintaining compatibility.
29-
30-
While `conda` manages compatibility between the packages in the environment, by default, this does not guarantee reproducible builds over time.
31-
An environment created with a list of packages _today_ can differ from that same environment created with the same
32-
list of packages _tomorrow_. This can happen because package dependencies have changed, new releases have occurred,
33-
or even because a package is no longer available.
34-
35-
### What is `conda-store`?
36-
37-
[`conda-store`][conda-store-docs] is a Python package that serves _identical_ `conda` environments by controlling the
38-
environment lifecycle.
39-
It ensures that the management, building, and serving of environments is as identical as possible and seamless for the end users.
40-
41-
All environments in Nebari are served through `conda-store`.
42-
43-
Using `conda-store`, Nebari admins can track specific files or directories for changes in environment specifications.
44-
They can manage environments using the web interface, REST API, or the command-line utility (CLI).
45-
This tutorial focuses on using the web interface to interact with our environments.
46-
47-
## Step 1 - Exploring the `conda-store` web interface
48-
49-
1. To get started, navigate to `https://<your-nebari-domain>/conda-store` (e.g. <https://quansight.nebari.dev/conda-store>).
50-
51-
2. You will need to log in to authenticate to the `conda-store` interface - this is required to be able to access most of `conda-store` functionalities.
52-
53-
![conda-store login UI - before authentication](/img/tutorials/conda_store_login.png)
54-
55-
3. This will lead you through a series of windows to authorize with Keycloak, after which you will have access to the
56-
`conda-store` dashboard. By default, you will be directed to the user page containing information about your account and the associated permissions.
57-
58-
![conda-store dashboard UI - after authentication](/img/tutorials/conda_store_dashboard.png)
59-
60-
Some useful sections to notice in the `user` page are:
61-
62-
- **User**: this section of the dashboard allows users to explicitly logout of the interface.
63-
- **Namespaces**: `Namespaces` are an important part of the `conda-store` [authorization model][conda-store-docs-auth]. They
64-
control what level of access users are provided to the individual environments. In other words, based on your
65-
permissions in each namespace, your ability to create, read, update, or delete and environment will differ.
66-
- **Permissions**: your current permissions in each namespace.
67-
68-
That is, unless your admin has configured your namespace differently. You can see here that the `conda-store`
69-
authorization model is able to provide admins with a fine-grained level of control.
70-
71-
## Step 2 - Creating a new environment
14+
Refrain from installing libraries directly in the notebook or through the terminal
15+
(outside a conda-store managed environment). These actions could lead to subtle
16+
and unforeseen problems with your environment.
17+
:::
7218

73-
1. To create a new environment, click on the `Create New Environment` button on the top right of the navigation bar. You will
74-
be presented with an option to upload a
75-
[conda YAML file](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file)
76-
or write your own.
19+
## Preliminary reading
7720

78-
![conda-store create environment UI](/img/tutorials/conda_store_create_env.png)
21+
It's useful to understand basics of conda-store and how it builds on top of the
22+
conda ecosystem, to use it effectively in Nebari.
7923

80-
For this tutorial, you can copy and paste the following environment specification:
24+
- [Essential conda concepts: Packages, environments, channels, dependencies, etc.](https://conda.store/conda-store/explanations/conda-concepts)
25+
- [conda-store concepts: Reproducibility, namespaces, environment versions, roles, etc.](https://conda.store/conda-store/explanations/conda-store-concepts)
8126

82-
```yaml title="Sample environment specification"
83-
channels:
84-
- conda-forge
85-
dependencies:
86-
- python=3.9
87-
- numpy
88-
- matplotlib
89-
- pandas
90-
- panel
91-
- ipykernel
92-
- ipywidgets
93-
name: example-environment
94-
prefix: null
95-
```
27+
Nebari has conda-store integrated, and you can use it through the graphical UI.
9628

97-
2. After you copy the above into the UI, go ahead and click the `Submit` button.
29+
## Open `conda-store` web interface
9830

99-
3. You will be redirected to the environments overview page. Find the card with the name of the new environment under your user's namespace (e.g.
100-
`<your-username>/example-environment`).
31+
![Conda Store WebUI interface](/img/tutorials/conda_store_webui.png)
10132

102-
![Newly create environment card](/img/tutorials/conda_store_new_env.png)
33+
There are several options for navigating to conda-store:
10334

104-
4. Click on the card for your newly created environment. The UI will display the environment specification:
35+
- From Nebari Home, click on **"Environment Management"** under "Services"
36+
- From JupyterLab, click on `Nebari` in the menu bar and go to **"Environments"**
37+
- From anywhere, go to URL: `https://<your-nebari-domain>/conda-store`
10538

106-
![conda-store - Environment details page](/img/tutorials/conda_store_env_details.png)
39+
If not logged in to conda-store, click on the **"Log in"** button in th left
40+
sidebar and authenticate similar to the [Nebari login][login-keycloak]. This is
41+
required to be able to access many `conda-store` features.
10742

108-
If this is the first time visiting this page, the environment may still be in the process of building.
109-
The page will automatically update when the build is complete.
43+
## Create, edit, and manage environments
11044

111-
From this page, you can `Edit` your YAML specification, or even `Delete` the environment.
45+
Go through the following conda-store (UI) tutorials
46+
on using the graphical interface for various actions:
11247

113-
:::note
114-
`conda-store` tracks all the environments behind the scenes for the users. Even if a user "deletes" an environment,
115-
it will still exist in the store. This ensures admins always have access to environment history.
116-
:::
48+
- [Create new environments][cs-create-env]
49+
- [Edit & delete existing environments][cs-edit-delete-env]
50+
- [Switch environment versions][version-control]
11751

118-
5. Now let's take a closer look at the `conda` build detail, to do this, click on the build number link in the `conda-store` interface.
119-
This will display a new page with the metadata about the environment including the time, size and status.
120-
Also included is your original YAML specification and a list of all the installed dependencies, their version and the used `conda` channels.
52+
## Default namespaces in Nebari
12153

122-
![conda-store UI - Sample environment build details page: showing build details, specification file, and conda packages](/img/tutorials/conda_store_build_details_top.png)
54+
A default Nebari deployment/instance has the following namespaces corresponding
55+
to [Nebari groups][configure-keycloak-groups]:
12356

124-
Scroll down to the bottom of this list, and you'll see a section called `Conda Environment Artifacts`.
125-
This is where you can download your own copy of the YAML file, a [conda-lock](https://conda.github.io/conda-lock/) file, and a `tar.gz` archive of the environment.
57+
<!-- Verify the roles and actions -->
12658

127-
![conda-store UI - Sample environment build details page: showing the conda environment artifacts](/img/tutorials/conda_store_build_details_bottom.png)
59+
- `analyst` namespace - Users in the `analyst` group can view and `admin` group
60+
can view+edit the environments in this namespace
61+
- `developer` namespace - Users in the `developer` and `admin` groups can view+edit
62+
the environments in this namespace
63+
- `nebari-git` namespace - Everyone can view and `admin`s can edit
12864

129-
6. Lastly, click on `Full Logs` to view the full output from the `conda` build.
65+
As an individual user, you also have a personal namespace with the same name as
66+
your Nebari username.
13067

13168
:::note
132-
If you want to use your new environment in a Jupyter Notebook, don't forget to include `ipykernel` and `ipywidgets` in
133-
your environment’s `yaml` file, or it may not be visible in the list of available kernels.
69+
If you can "view" an environment, you can use it.
13470
:::
13571

136-
## Step 3 - Installing packages via `conda` or `pip`
72+
## Select environments in editors
13773

138-
To install new packages through either `conda` or `pip` you'll need to navigate back to the `Edit` page of your environment
139-
in the `conda-store` web interface.
74+
Instructions to select any environment you have access to in the following editing
75+
spaces:
14076

141-
Adding `conda` packages to a `conda-store` environment via the command line, is not possible since the files are
142-
read-only in that context.
77+
- **JupyterLab** - In a Jupyter Notebook, click on the "Select Kernel" dropdown in
78+
the top-left corner, and select the environment.
14379

144-
Additionally, adding `pip` packages via the command line is strongly discouraged. Not only do `conda` and `pip` not
145-
always play nice together, but it can lead to some inconsistencies across users' dependencies.
146-
This happens because when you `pip` install a package from the command line this is installed in your `.local` folder, so this changes will not be applied to other Nebari users.
80+
- **VS Code** - Click on the βš™οΈ icon in the bottom-right to open `Settings` ->
81+
`Command Palette`, and type "Python: Select Interpreter" and press <kbd>Enter</kbd>
82+
to get the list of environments to select from.
14783

148-
:::note
149-
One exception to this rule is packages that you are actively developing.
150-
As you are building a package, you will likely want to install it as a _dev_ package.
151-
This can be done using:
84+
- **Terminal** - In the terminal window, you can use `conda` CLI commands like
85+
`conda activate <namespace>-<environment_name>` to activate the relevant
86+
environment and `conda env list` to view the list of available environments.
15287

153-
```bash
154-
pip install --no-build-isolation --user -e .
155-
```
88+
## Special requirements
15689

157-
Or, if you’re using `flit`, you can install with:
90+
### Dask
15891

159-
```bash
160-
flit install -s
161-
```
92+
Include the [`nebari-dask` metapackage](https://anaconda.org/conda-forge/nebari-dask)
93+
in your environment to use Dask. This ensures you have the correct version of
94+
`dask-gateway` and the latest versions of `dask` and `distributed` libraries.
16295

163-
Please keep in mind that these are _NOT_ available to Dask workers!
164-
:::
96+
By default, the `nebari-git-nebari-git-dask` environment (available to everyone)
97+
can be used for basic Dask workflows.
16598

166-
## Troubleshooting
99+
### JHub App Launcher
167100

168-
1. If you have an environment that fails to build properly, you'll be able to see this failure on the build status page.
101+
Include the `jhub-apps` package in your environment to create apps using the
102+
JHub App Launcher. You will also need the relevant app development framework
103+
and other necessary packages in the environment.
169104

170-
Navigate to the `Full Logs` to investigate in more detail. Also, from the build status page you can trigger re-build in
171-
case you hit issues with intermittent outages, etc.
105+
<!-- External links -->
172106

173-
2. If you need to use Dask.
107+
[conda-store-docs]: https://conda.store/
108+
[cs-create-env]: https://conda.store/conda-store-ui/tutorials/create-envs
109+
[cs-edit-delete-env]: https://conda.store/conda-store-ui/tutorials/edit-delete-envs
110+
[version-control]: https://conda.store/conda-store-ui/tutorials/version-control
174111

175-
We highly recommend you include the [Nebari Dask metapackage](https://anaconda.org/conda-forge/nebari-dask) to maintain version compatibility between the Dask client and server.
176-
This replaces `distributed`, `dask`, and `dask-gateway` with the correctly pinned versions.
112+
<!-- Internal links -->
177113

178-
<!-- reusable links -->
114+
<!--Update when PR#397 is merged -->
179115

180-
[conda-store-docs]: https://conda-store.readthedocs.io/
181-
[conda-store-docs-auth]: https://conda-store.readthedocs.io/en/latest/contributing.html#authorization-model
116+
[login-keycloak]: /docs/tutorials/login-keycloak
117+
[configure-keycloak-groups]: /docs/how-tos/configuring-keycloak#in-depth-look-at-roles-and-groups
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
106 KB
Loading

0 commit comments

Comments
Β (0)