-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-conda-environment.sh
executable file
·71 lines (48 loc) · 1.37 KB
/
make-conda-environment.sh
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
64
65
66
67
68
69
70
71
#!/bin/bash
MANAGER="mamba"
NAME=sproc
LIBRARIES=(
jupyterlab jupyter_console
nbdev"="2.3.11
colorama
python-magic
pyyaml
html2text
lxml
pandas
pyarrow
openpyxl
ruamel.yaml
# rich ipywidgets
tqdm ipywidgets
)
CHANNELS=(
defaults
conda-forge
fastai # nbdev
)
# ---
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\"
# # the environment is exported into a yaml file
# conda env export --no-builds --from-history -f environment.yml