Skip to content

Commit ea61dd8

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] [Nova] Fix extensions in wheels build (#6972)
Summary: * Fix extensions in wheels build * pass pre-script from caller * add pre-script to run relocate on wheel * install auditwheel for relocate * reorder numpy install * use jpeg80 for py3.9 and py3.10 mac builds * revert back to jpeg9 * printing the found jpeg libs during build time and reintro circle for comparison * more debug logs, remove extra linux builds * typo fix * brew uninstall conflicting jpeg libraries on mac machines * fix path for unittests * ufmt Reviewed By: YosuaMichael Differential Revision: D41648542 fbshipit-source-id: 4ffb5af01fc546fc19789ea651548af43e5ee5cb
1 parent 6b4cd7b commit ea61dd8

File tree

6 files changed

+47
-6
lines changed

6 files changed

+47
-6
lines changed

.github/workflows/build-wheels-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
matrix:
2323
include:
2424
- repository: pytorch/vision
25-
pre-script: ""
26-
post-script: ""
25+
pre-script: packaging/pre_build_script.sh
26+
post-script: packaging/post_build_script.sh
2727
smoke-test-script: test/smoke_test.py
2828
package-name: torchvision
2929
name: ${{ matrix.repository }}

.github/workflows/build-wheels-m1.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
matrix:
2323
include:
2424
- repository: pytorch/vision
25-
pre-script: ""
26-
post-script: ""
25+
pre-script: packaging/pre_build_script.sh
26+
post-script: packaging/post_build_script.sh
2727
smoke-test-script: test/smoke_test.py
2828
package-name: torchvision
2929
name: ${{ matrix.repository }}

.github/workflows/build-wheels-macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
matrix:
2323
include:
2424
- repository: pytorch/vision
25-
pre-script: ""
26-
post-script: ""
25+
pre-script: packaging/pre_build_script.sh
26+
post-script: packaging/post_build_script.sh
2727
smoke-test-script: test/smoke_test.py
2828
package-name: torchvision
2929
name: ${{ matrix.repository }}

packaging/post_build_script.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LD_LIBRARY_PATH="/usr/local/lib:$CUDA_HOME/lib64:$LD_LIBRARY_PATH" python packaging/wheel/relocate.py

packaging/pre_build_script.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
if [[ "$(uname)" == Darwin || "$OSTYPE" == "msys" ]]; then
2+
# Uninstall Conflicting jpeg brew formulae
3+
jpeg_packages=$(brew list | grep jpeg)
4+
echo "Existing Jpeg-related Brew libraries"
5+
echo $jpeg_packages
6+
for pkg in $jpeg_packages; do
7+
brew uninstall --ignore-dependencies --force $pkg || true
8+
done
9+
10+
# Install libpng from Anaconda (defaults)
11+
conda install ${CONDA_CHANNEL_FLAGS} libpng "jpeg<=9b" -y
12+
conda install -yq ffmpeg=4.2 -c pytorch
13+
conda install -yq wget
14+
else
15+
# Install native CentOS libJPEG, freetype and GnuTLS
16+
yum install -y libjpeg-turbo-devel freetype gnutls
17+
18+
# Download all the dependencies required to compile image and video_reader
19+
# extensions
20+
mkdir -p ext_libraries
21+
pushd ext_libraries
22+
popd
23+
export PATH="$(pwd)/ext_libraries/bin:$PATH"
24+
pip install auditwheel
25+
26+
# Point to custom libraries
27+
export LD_LIBRARY_PATH=$(pwd)/ext_libraries/lib:$LD_LIBRARY_PATH
28+
export TORCHVISION_INCLUDE=$(pwd)/ext_libraries/include
29+
export TORCHVISION_LIBRARY=$(pwd)/ext_libraries/lib
30+
fi
31+
32+
pip install numpy pyyaml future ninja
33+
pip install --upgrade setuptools

test/smoke_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
"""Run smoke tests"""
22

3+
import os
4+
35
import torchvision
6+
from torchvision.io import read_image
47

8+
image_path = os.path.join(
9+
os.path.dirname(os.path.abspath(__file__)), "assets", "encode_jpeg", "grace_hopper_517x606.jpg"
10+
)
511
print("torchvision version is ", torchvision.__version__)
12+
img = read_image(image_path)

0 commit comments

Comments
 (0)