-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-conda-environment.sh
More file actions
executable file
·63 lines (41 loc) · 1.26 KB
/
Copy pathmake-conda-environment.sh
File metadata and controls
executable file
·63 lines (41 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
MANAGER="mamba"
NAME=mlh
LIBRARIES=(
python
jupyterlab
nbdev">=2.3"
pytorch torchvision torchaudio cpuonly
torchdiffeq
ipywidgets # not actually needed, but it avoids an annoying warning
seaborn">="0.12
)
CHANNELS=(
defaults
conda-forge
fastchan # nbdev
pytorch
)
# ---
COLOR="\033[40m\033[32m"
UNCOLOR="\033[0m"
# ------------ setup
# only required if "anaconda" is not in the path
source $HOME/$MY_CONDA_INSTALLATION/etc/profile.d/conda.sh
# from https://stackoverflow.com/a/9429887/3967334
LIBRARIES_CONCATENATED=$(IFS=" " ; echo "${LIBRARIES[*]}")
# from https://stackoverflow.com/a/17841619/3967334
function join_by { local d=${1-} f=${2-}; if shift 2; then printf %s "$f" "${@/#/$d}"; fi; }
CHANNELS_CONCATENATED=$(join_by ' -c ' "${CHANNELS[@]}")
# ------------ installation
$MANAGER create --yes -n $NAME $LIBRARIES_CONCATENATED -c $CHANNELS_CONCATENATED
# ------------ pip
conda activate $NAME
# pip stuff here....
# ------------ nbdev
# so that git is aware of nbdev/notebooks (only required once, when creating the repository, not through re-installs of conda)
nbdev_install_hooks
# this library is installed "live"
pip install -e .
# ------------
echo -e new environment is \"$COLOR$NAME$UNCOLOR\"