Skip to content

Commit ec478af

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Fix CI job (#73)
Summary: Pull Request resolved: #73 Apparently in macos CI, python3 and python are pointing to different python environment. python3 -> /Library/Python/3.9/site-packages/ python -> /Users/ec2-user/runner/_work/_temp/miniconda/lib/python3.9/site-packages This diff is fixing the CI failure: ``` [2023-08-17T02:59:12.739+00:00] Local command: env -- "ASAN_OPTIONS=detect_leaks=0,detect_odr_violation=0" "GEN_DIR=GEN_DIR_DEPRECATED" "OUT=././../out" "SRCDIR=./." "SRCS=././link_torch.sh" /usr/bin/env bash -e buck-out/v2/gen/root/213ed1b7ab869379/third-party/__libtorch_gen__/sh/genrule.sh [2023-08-17T02:59:12.739+00:00] Stdout: Error: /Library/Python/3.9/site-packages/torch/lib/libtorch.dylib doesn't exist ``` Also adding `tomli` as a ci requirements due to the following error: ``` Error: Traceback (most recent call last): File "/Users/ec2-user/runner/_work/executorch/executorch/pytorch/executorch/build/extract_sources.py", line 18, in <module> import tomllib # Standard in 3.11 and later ModuleNotFoundError: No module named 'tomllib' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/ec2-user/runner/_work/executorch/executorch/pytorch/executorch/build/extract_sources.py", line 20, in <module> import tomli as tomllib ModuleNotFoundError: No module named 'tomli' CMake Error at CMakeLists.txt:101 (message): executorch: source list generation failed ``` Reviewed By: huydhn, cccclai Differential Revision: D48423480 fbshipit-source-id: 39e864a834920dac93fbd479705ad4bdb67516ac
1 parent 3644b60 commit ec478af

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

.github/workflows/pull.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
bash .ci/scripts/test.sh
5252
5353
# Test custom ops
54-
bash examples/custom_ops/test_custom_ops.sh buck2
54+
PYTHON_EXECUTABLE=python bash examples/custom_ops/test_custom_ops.sh buck2
5555
popd
5656
5757
cmake-build-test-linux:
@@ -90,5 +90,5 @@ jobs:
9090
bash .ci/scripts/setup-macos.sh
9191
9292
# Build and test custom ops
93-
bash examples/custom_ops/test_custom_ops.sh cmake
93+
PYTHON_EXECUTABLE=python bash examples/custom_ops/test_custom_ops.sh cmake
9494
popd

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ endif()
6262
if(NOT BUCK2)
6363
set(BUCK2 buck2)
6464
endif()
65+
if(NOT PYTHON_EXECUTABLE)
66+
set(PYTHON_EXECUTABLE python3)
67+
endif()
6568

6669
# TODO(dbort): Fix these warnings and remove this flag.
6770
set(_common_compile_options -Wno-deprecated-declarations)

examples/custom_ops/test_custom_ops.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set -e
1414
test_buck2_custom_op_1() {
1515
local model_name='custom_ops_1'
1616
echo "Exporting ${model_name}.pte"
17-
python -m "examples.custom_ops.${model_name}"
17+
${PYTHON_EXECUTABLE} -m "examples.custom_ops.${model_name}"
1818
# should save file custom_ops_1.pte
1919

2020
echo 'Running executor_runner'
@@ -29,7 +29,7 @@ test_buck2_custom_op_1() {
2929
test_cmake_custom_op_1() {
3030
local model_name='custom_ops_1'
3131
echo "Exporting ${model_name}.pte"
32-
python -m "examples.custom_ops.${model_name}"
32+
${PYTHON_EXECUTABLE} -m "examples.custom_ops.${model_name}"
3333
# should save file custom_ops_1.pte
3434
(rm -rf cmake-out \
3535
&& mkdir cmake-out \
@@ -50,7 +50,7 @@ test_buck2_custom_op_2() {
5050
SO_LIB=$(buck2 build //examples/custom_ops:custom_ops_aot_lib_2 --show-output | grep "buck-out" | cut -d" " -f2)
5151

5252
echo "Exporting ${model_name}.pte"
53-
python -m "examples.custom_ops.${model_name}" --so_library="$SO_LIB"
53+
${PYTHON_EXECUTABLE} -m "examples.custom_ops.${model_name}" --so_library="$SO_LIB"
5454
# should save file custom_ops_2.pte
5555

5656
buck2 run //examples/executor_runner:executor_runner \
@@ -77,7 +77,7 @@ get_shared_lib_ext() {
7777

7878
test_cmake_custom_op_2() {
7979
local model_name='custom_ops_2'
80-
SITE_PACKAGES="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
80+
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
8181
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"
8282

8383
(rm -rf cmake-out \
@@ -92,13 +92,17 @@ test_cmake_custom_op_2() {
9292

9393
EXT=$(get_shared_lib_ext)
9494
echo "Exporting ${model_name}.pte"
95-
python -m "examples.custom_ops.${model_name}" --so_library="cmake-out/examples/custom_ops/libcustom_ops_aot_lib$EXT"
95+
${PYTHON_EXECUTABLE} -m "examples.custom_ops.${model_name}" --so_library="cmake-out/examples/custom_ops/libcustom_ops_aot_lib$EXT"
9696
# should save file custom_ops_2.pte
9797

9898
echo 'Running executor_runner'
9999
cmake-out/executor_runner "--model_path=./${model_name}.pte"
100100
}
101101

102+
if [[ -z $PYTHON_EXECUTABLE ]];
103+
then
104+
PYTHON_EXECUTABLE=python3
105+
fi
102106
if [[ $1 == "cmake" ]];
103107
then
104108
test_cmake_custom_op_1

third-party/link_torch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ while getopts ":o:f:" opt; do
3333
esac
3434
done
3535

36-
LIB=$(python3 -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
36+
LIB=$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
3737

3838
# delimiter ,
3939
export IFS=","

0 commit comments

Comments
 (0)