osx_wheel.sh 1.72 KB
Newer Older
1
2
3
4
#!/bin/bash

set -ex

5
6
7
8
9
10
11
12
13
14
15
16
17
if [[ ":$PATH:" == *"conda"* ]]; then
    echo "existing anaconda install in PATH, remove it and run script"
    exit 1
fi
# download and activate anaconda
rm -rf ~/minconda_wheel_env_tmp
wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh && \
    chmod +x Miniconda3-latest-MacOSX-x86_64.sh && \
    ./Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/minconda_wheel_env_tmp && \
    rm Miniconda3-latest-MacOSX-x86_64.sh

. ~/minconda_wheel_env_tmp/bin/activate

18
export TORCHAUDIO_BUILD_VERSION="0.4.0.dev$(date "+%Y%m%d")"
19
20
21
22
23
24
25
26
27
export TORCHAUDIO_BUILD_NUMBER="1"
export OUT_DIR=~/torchaudio_wheels

export MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++

CURR_PATH=$(pwd)

cd /tmp
rm -rf audio
28
git clone https://github.com/pytorch/audio
29
30
mkdir audio/third_party

31
export PREFIX="/tmp/audio"
32
33
34
35
36
37
38
39
40
41
42
43
44
. $CURR_PATH/build_from_source.sh

cd /tmp/audio

desired_pythons=( "2.7" "3.5" "3.6" "3.7" )
# for each python
for desired_python in "${desired_pythons[@]}"
do
    # create and activate python env
    env_name="env$desired_python"
    conda create -yn $env_name python="$desired_python"
    conda activate $env_name

45
    export TORCHAUDIO_PYTORCH_DEPENDENCY_NAME=torch_nightly
46
    pip install torch_nightly -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
47
    # NB: OS X builds don't have local package qualifiers
48
49
    # NB: Don't use \+ here, it's not portable
    export TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION="$(pip show torch_nightly | grep ^Version: | sed 's/Version:  *//')"
50
51
    echo "Building against ${TORCHAUDIO_PYTORCH_DEPENDENCY_VERSION}"

52
    pip install numpy future
53
54
55
56
57
    IS_WHEEL=1 python setup.py clean
    IS_WHEEL=1 python setup.py bdist_wheel
    mkdir -p $OUT_DIR
    cp dist/*.whl $OUT_DIR/
done