Skip to content

Commit 58ec046

Browse files
authored
Merge pull request #205 from asmacdo/conda-store-docs
User docs for Conda environments in dandi-hub
2 parents 0efb087 + aca3e29 commit 58ec046

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

docs/user-guide-using/dandi-hub.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,96 @@ We request that users of this server be considerate of their usage of the DANDI
1919
Training large deep neural networks is not appropriate.
2020
A "Base (MATLAB)" server is also available, which provides a MATLAB cloud installation but you would be required to provide your own license.
2121

22+
## Using conda environments
23+
24+
DANDI Hub provides two ways to work with Python environments: shared environments managed through conda-store, and individual environments you create with conda in your home directory.
25+
26+
**Shared environments** are managed through conda-store and are available to all DANDI Hub users.
27+
These environments contain commonly used packages for neurophysiology analysis and are maintained by administrators.
28+
Use shared environments when:
29+
- You need standard analysis tools and packages
30+
- You want to collaborate with other users using the same environment
31+
- You prefer not to manage package dependencies yourself
32+
33+
**Individual environments** are created and managed using standard conda commands in your user home directory (`/home/username`).
34+
These are private to your account and **should be used instead of conda-store for personal environments**.
35+
Create individual environments when:
36+
- You need specific package versions not available in shared environments
37+
- You're experimenting with new packages or configurations
38+
- You need a customized environment for your specific analysis workflow
39+
40+
**Important:** Do not use conda-store for creating individual environments.
41+
Conda-store is a deployment service for shared environments only.
42+
Use regular conda commands for personal environments in your home directory.
43+
44+
### Using shared environments
45+
46+
#### Activating in the terminal
47+
48+
To see available shared environments:
49+
```bash
50+
conda env list
51+
```
52+
53+
To activate a shared environment:
54+
```bash
55+
conda activate environment-name
56+
```
57+
58+
For example, to activate the dandi environment:
59+
```bash
60+
conda activate nebari-git-dandi
61+
```
62+
63+
#### Activating in your Jupyter notebook
64+
65+
**At startup:** When launching JupyterLab, you can select a shared environment from the kernel dropdown in the launcher.
66+
67+
**In an existing notebook:**
68+
69+
1. In the top right of a notebook, click the current environment which will open a "Start a new kernel for mynotebook.ipynb"
70+
2. Select the desired shared environment from the list
71+
3. The notebook will switch to use packages from that environment
72+
73+
### Creating individual environments
74+
75+
#### Lightweight `venv` overlay
76+
77+
If you need to use an environment, ie `dandi` with extra dependencies, please **do not** create a new conda environment.
78+
Instead use `venv` to create a local virtual environment **on top of an existing env.**
79+
80+
```bash
81+
conda activate nebari-git-dandi
82+
python -m venv --system-site-packages my-dandi-extras
83+
source my-dandi-extras/bin/activate
84+
pip install some-extra-package
85+
```
86+
87+
#### Full custom `conda` environment
88+
89+
If you need to create a conda env make sure it is stored in your home directory using the `--prefix` flag:
90+
91+
```bash
92+
conda create --prefix /home/username/.conda/envs/my-env-name python=3.9
93+
```
94+
95+
To activate your individual environment:
96+
97+
```bash
98+
conda activate /home/username/.conda/envs/my-env-name
99+
```
100+
101+
To install packages in your individual environment:
102+
103+
```bash
104+
conda activate /home/username/.conda/envs/my-env-name
105+
conda install package-name
106+
# or
107+
pip install package-name
108+
```
109+
110+
**Note:** Replace `username` with your actual username, or use `$HOME` instead of `/home/username`.
111+
22112
## Custom server image
23113

24114
If you need additional software installed in the image, you can add a server image that will be made available for all users in the `Server Options` menu. Add a server image by following the instructions below and submitting a pull request to the [dandi-hub repository](https://github.com/dandi/dandi-hub). Once the pull request is merged, the DANDI team will redeploy JupyterHub and the image will be available.

0 commit comments

Comments
 (0)