-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivate_venv
executable file
·126 lines (102 loc) · 3.89 KB
/
activate_venv
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
# Bootstrap a new VEnv in ./_hesiod_venv suitable for running Hesiod.
# The idea is that we make a new VEnv for each version released and so
# we really can roll back to an old version and get the exact same
# behaviour.
# Note that unlike Illuminatus I'm going to install snakemake into
# the VEnv. I'll likely make the same change for Illuminatus soon, but
# see doc/snakemake_be_careful.txt.
if [[ "$0" == "$BASH_SOURCE" ]] ; then
echo "You need to source this file, not run it."
exit 1
fi
activate_venv() {
#We need to ensure -u is not set but then put the old value back.
local reset=$(set +o | grep -w nounset) ; set +o nounset
source ./_hesiod_venv/bin/activate
eval $reset
}
pip_install() {
# Send all output to stdout
pip3 --disable-pip-version-check install --prefer-binary "$@" 2>&1
}
check_setuptools() {
# I compiled python and _ctypes was broken but pip masks the real error,
# so run this check explicitly.
python3 -c 'import setuptools'
}
if [ -e ./_hesiod_venv/bin/activate ] ; then
# We already got one!
activate_venv
else
( set -e ;
# Best to resolve the symlink before bootstrapping the VEnv
_py3="${TOOLBOX:-`dirname $BASH_SOURCE`/toolbox}"/bootstrap_python3
_py3_real="$(readlink -m "$_py3")"
echo "Bootstrapping new VEnv from $_py3 ($_py3_real)"
"$_py3_real" -mvenv ./_hesiod_venv
activate_venv
# We need to upgrade pip so that --prefer-binary is a valid option
pip3 --disable-pip-version-check install --upgrade 'pip>22' 2>&1
# A check that the Python is not broken
check_setuptools
pip_install wheel
pip_install 'pyyaml<6.1'
pip_install 'yamlloader<2'
pip_install rt==2.2.2
pip_install python-dateutil==2.8.2
pip_install 'numpy<1.24' # upgrade with NanoPlot. Install before matplotlib
# My test helper
pip_install bashmocker==0.3.0
# things needed for Blobtools - we are using
# https://github.com/EdinburghGenomics/blobtools/tree/tims_patches
pip_install docopt==0.6.2
pip_install matplotlib==3.3.3
pip_install pysam==0.22.1
pip_install tqdm==4.64.0
pip_install ujson==5.2.0
# snakemake and drmaa (note the settings/wrapper in shell_helper_functions.sh)
pip_install yte==1.5.4
pip_install tabulate==0.9.0
pip_install reretry==0.11.8
pip_install throttler==1.2.2
pip_install PuLP==2.9.0
pip_install snakemake==7.18.2
pip_install drmaa==0.7.9
# My patches for Snakemake bugs : 'v7.18.2.x'
# Not needed for unit tests
pip_install 'git+https://github.com/EdinburghGenomics/snakemake.git@speed_hack#egg=snakemake'
# For access the Clarity
pip_install pyclarity_lims==0.4.8
pip_install psycopg2-binary==2.9.9
# For get_fast5_metadata.py
pip_install h5py==3.11.0
# For get_pod5_metadata.py
pip_install pyarrow==16.1.0
pip_install pod5==0.3.11
# Here’s the big one
pip_install pauvre==0.2 # upgrade with NanoPlot
pip_install pillow==8.4.0
pip_install seaborn==0.10.1 # upgrade with NanoPlot
pip_install kaleido==0.2.1
pip_install threadpoolctl==3.1.0
pip_install biopython==1.79 # was 1.76
pip_install tenacity==8.0.1
pip_install plotly==5.7.0
# Newer NanoPlot has some significant changes
pip_install NanoPlot==1.33.1
# For counting likely duplex reads
pip_install duplex_tools==0.3.3
# Helpful for running the unit tests
pip_install pyflakes
)
if [ $? = 0 ] ; then
echo "VEnv provisioned OK"
# We need this since we quit the subshell
activate_venv
else
unset -f pip_install
echo "Provisioning VEnv Failed!"
false
fi
fi