-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconda-create-env.sh
executable file
·68 lines (51 loc) · 1.3 KB
/
conda-create-env.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
#!/bin/bash
envname=$1
if [[ "x$envname" == "x" ]]
then
envname=farm-tools
fi
echo Trying to create environment $envname
set -e
set -o pipefail
trap "echo Terminating script, something went wrong!!!" EXIT
d=`which conda || /bin/true`
if [[ "x$d" == "x" ]]
then
echo no conda !!!
exit 1
fi
echo conda found at $d
d=`dirname $d`
c=$d/../etc/profile.d/conda.sh
if [ ! -f $c ]
then
echo not found $c
echo run conda init bash
exit 1
fi
. $c
conda create -y -n $envname python=3.8
conda init bash
conda activate $envname
echo Activated $envname running from `pwd`
# we cannot pip install FARM any longer since its requirements are broken
# instead we will clone farm, update the requirements with our own and then install locally
# are we in the correct directory?
# was farm-requirements.tmp
if [ ! -f farm-requirements.txt ]
then
echo Please run this from farm-tools root directory
exit 1
fi
git clone https://github.com/deepset-ai/FARM.git
cp farm-requirements.txt FARM/requirements.txt
cp farm-version.py FARM/farm/_version.py
pushd FARM
pip install -r requirements.txt
pip install -e .
popd
pip install -r farm-tool-requirements.txt
pip install -e .
python -m ipykernel install --user --name=$envname
trap - EXIT
echo conda environment $envname and ipykernel $envname created successfully