forked from pytorch/text
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_env.sh
51 lines (41 loc) · 1.69 KB
/
setup_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
#!/usr/bin/env bash
# This script is for setting up environment in which unit test is ran.
# To speed up the CI time, the resulting environment is cached.
#
# Do not install PyTorch and torchtext here, otherwise they also get cached.
set -e
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
root_dir="$(git rev-parse --show-toplevel)"
conda_dir="${root_dir}/conda"
env_dir="${root_dir}/env"
cd "${root_dir}"
# 1. Install conda at ./conda
if [ ! -d "${conda_dir}" ]; then
printf "* Installing conda\n"
export tmp_conda="$(echo $conda_dir | tr '/' '\\')"
export miniconda_exe="$(echo $root_dir | tr '/' '\\')\\miniconda.exe"
curl --output miniconda.exe https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -O
"$this_dir/install_conda.bat"
unset tmp_conda
unset miniconda_exe
fi
eval "$(${conda_dir}/Scripts/conda.exe 'shell.bash' 'hook')"
# 2. Create test environment at ./env
if [ ! -d "${env_dir}" ]; then
printf "* Creating a test environment\n"
conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION"
fi
conda activate "${env_dir}"
# 3. Install minimal build tools
pip --quiet install cmake>=3.18.0 ninja
# 4. Install Conda dependencies
printf "* Installing dependencies (except PyTorch)\n"
conda env update --file "${this_dir}/environment.yml" --prune
# 5. Download
printf "* Downloading SpaCy English models\n"
python -m spacy download en_core_web_sm
printf "* Downloading SpaCy German models\n"
python -m spacy download de_core_news_sm
# 6. Post install script for pywin32
curl --output pywin32_postinstall.py https://raw.githubusercontent.com/mhammond/pywin32/main/pywin32_postinstall.p
python pywin32_postinstall.py -install