Skip to content

Commit b9cac74

Browse files
jamarshonezyang
authored andcommitted
Packaging improvements for nightlies (#198) (#205)
* Packaging improvements for nightlies - Instructions for how to install stable and master binaries, without hardcoding wheel filenames - Turn on Python 2 build (numba is only needed for testing) - Make builds a little more hermetic - Prefer building against nightly CPU-only torch build - Don't install all of requirements.txt, it's not necessary - Updates for OS X too, including portability issues Signed-off-by: Edward Z. Yang <ezyang@fb.com> (cherry picked from commit 4542332)
1 parent ca16902 commit b9cac74

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

build_tools/packaging/wheel/build_from_source.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,21 @@ popd
2828

2929
# build mad, statically
3030
pushd libmad-0.15.1b
31+
# See https://stackoverflow.com/a/12864879/23845
32+
sed -i.bak 's/-march=i486//' configure
3133
./configure --disable-shared --enable-static --prefix="$PREFIX/audio/third_party/mad" CFLAGS=-fPIC CXXFLAGS=-fPIC \
3234
--with-pic --disable-debug --disable-dependency-tracking
3335
make -s -j && make install
3436
popd
3537

3638
# build sox, statically
39+
# --without-png makes OS X build less hazardous; somehow the build
40+
# finds png and enables it. We don't want it; we'd need to package
41+
# it statically if we do.
3742
pushd sox-14.4.2
3843
./configure --disable-shared --enable-static --prefix="$PREFIX/audio/third_party/sox" \
3944
LDFLAGS="-L$PREFIX/audio/third_party/lame/lib -L$PREFIX/audio/third_party/flac/lib -L$PREFIX/audio/third_party/mad/lib" \
4045
CPPFLAGS="-I$PREFIX/audio/third_party/lame/include -I$PREFIX/audio/third_party/flac/include -I$PREFIX/audio/third_party/mad/include" \
41-
--with-lame --with-flac --with-mad --without-oggvorbis --without-oss --without-sndfile CFLAGS=-fPIC CXXFLAGS=-fPIC --with-pic --disable-debug --disable-dependency-tracking
46+
--with-lame --with-flac --with-mad --without-png --without-oggvorbis --without-oss --without-sndfile CFLAGS=-fPIC CXXFLAGS=-fPIC --with-pic --disable-debug --disable-dependency-tracking
4247
make -s -j && make install
4348
popd

build_tools/packaging/wheel/linux_manywheel.sh

+11-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$#" -ne 1 ]; then
55
fi
66
export CUVER="$1" # cu90 cu100 cpu
77

8-
export TORCHAUDIO_BUILD_VERSION="0.2.0"
8+
export TORCHAUDIO_BUILD_VERSION="0.3.0"
99
export TORCHAUDIO_BUILD_NUMBER="1"
1010
export OUT_DIR="/remote/$CUVER"
1111

@@ -27,13 +27,18 @@ export PREFIX="/tmp"
2727
cd /tmp/audio
2828

2929
for PYDIR in "${python_installations[@]}"; do
30-
# wheels for numba does not work with python 2.7
31-
if [[ "$PYDIR" == "/opt/python/cp27-cp27m/" || "$PYDIR" == "/opt/python/cp27-cp27mu/" ]]; then
32-
continue;
33-
fi
3430
export PATH=$PYDIR/bin:$OLD_PATH
3531
pip install --upgrade pip
36-
pip install -r requirements.txt
32+
33+
# For true hermetic builds, you ought to be constructing the docker
34+
# from scratch each time. But this makes things marginally safer if
35+
# you aren't doing this.
36+
pip uninstall -y torch || true
37+
pip uninstall -y torch_nightly || true
38+
39+
# NB: do not actually install requirements.txt; that is only needed for
40+
# testing
41+
pip install torch numpy future
3742
IS_WHEEL=1 python setup.py clean
3843
IS_WHEEL=1 python setup.py bdist_wheel
3944
mkdir -p $OUT_DIR

build_tools/packaging/wheel/osx_wheel.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh &
1111

1212
. ~/minconda_wheel_env_tmp/bin/activate
1313

14-
export TORCHAUDIO_BUILD_VERSION="0.2.0"
14+
export TORCHAUDIO_BUILD_VERSION="0.3.0"
1515
export TORCHAUDIO_BUILD_NUMBER="1"
1616
export OUT_DIR=~/torchaudio_wheels
1717

@@ -40,9 +40,7 @@ do
4040
conda create -yn $env_name python="$desired_python"
4141
conda activate $env_name
4242

43-
# install torchaudio dependencies
44-
pip install -r requirements.txt
45-
43+
pip install torch numpy future
4644
IS_WHEEL=1 python setup.py clean
4745
IS_WHEEL=1 python setup.py bdist_wheel
4846
mkdir -p $OUT_DIR

0 commit comments

Comments
 (0)