Skip to content

Commit deabee8

Browse files
authored
1167 protobuf fix (#1168)
Signed-off-by: Wenqi Li <[email protected]> Fixes #1167 the workaround should be applied per notebook, because each notebook may install a different set of deps. ### Checks <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [ ] Avoid including large-size files in the PR. - [ ] Clean up long text outputs from code cells in the notebook. - [ ] For security purposes, please check the contents and remove any sensitive info such as user names and private key. - [ ] Ensure (1) hyperlinks and markdown anchors are working (2) use relative paths for tutorial repo files (3) put figure and graphs in the `./figure` folder - [ ] Notebook runs automatically `./runner.sh -t <path to .ipynb file>` Signed-off-by: Wenqi Li <[email protected]>
1 parent 7403995 commit deabee8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

runner.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,6 @@ function print_usage {
157157
echo "To choose an alternative python executable, set the environmental variable, \"MONAI_PY_EXE\"."
158158
}
159159

160-
# FIXME: https://github.com/Project-MONAI/MONAI/issues/4354
161-
protobuf_major_version=$(${PY_EXE} -m pip list | grep '^protobuf ' | tr -s ' ' | cut -d' ' -f2 | cut -d'.' -f1)
162-
if [ "$protobuf_major_version" -ge "4" ]
163-
then
164-
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
165-
fi
166-
167160
function print_style_fail_msg() {
168161
echo "${red}Check failed!${noColor}"
169162
}
@@ -517,6 +510,16 @@ for file in "${files[@]}"; do
517510
done
518511

519512
python -c 'import monai; monai.config.print_config()'
513+
514+
# FIXME: https://github.com/Project-MONAI/MONAI/issues/4354
515+
protobuf_major_version=$(${PY_EXE} -m pip list | grep '^protobuf ' | tr -s ' ' | cut -d' ' -f2 | cut -d'.' -f1)
516+
if [ "$protobuf_major_version" -ge "4" ]
517+
then
518+
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
519+
else
520+
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=
521+
fi
522+
520523
cmd=$(echo "papermill ${papermill_opt} --progress-bar -k ${kernelspec}")
521524
echo "$cmd"
522525
time out=$(echo "$notebook" | eval "$cmd")

0 commit comments

Comments
 (0)