Skip to content

Commit cebc13a

Browse files
author
Helin Wang
committed
fix paddle pip install package version
1 parent a71218c commit cebc13a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

paddle/scripts/submit_local.sh.in

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,22 @@ else:
9494
EOF
9595

9696
if [ $? -eq 1 ]; then # Older version installed, or not installed at all
97-
echo "First time run paddle, need to install some python dependencies."
98-
BASEDIR=$(dirname "$0")
99-
pip install ${BASEDIR}/../opt/paddle/share/wheels/*-@PADDLE_VERSION@-*.whl
100-
if [ $? -ne 0 ]; then
101-
echo "pip install wheels failed. "
102-
echo "Please use 'sudo paddle' at the first time you use PaddlePaddle"
103-
echo "PaddlePaddle will install some python dependencies automatically."
104-
exit 1
105-
fi
106-
echo "Python dependencies are installed."
97+
echo "First time run paddle, need to install some python dependencies."
98+
# setuptools normalizes package version, so we need to use normalized
99+
# package version for paddle python package
100+
PYTHON_PADDLE_VERSION=$(python -c 'import packaging
101+
import setuptools
102+
print str(packaging.version.Version("@PADDLE_VERSION@"))
103+
' 2>/dev/null)
104+
BASEDIR=$(dirname "$0")
105+
pip install ${BASEDIR}/../opt/paddle/share/wheels/*-${PYTHON_PADDLE_VERSION}-*.whl
106+
if [ $? -ne 0 ]; then
107+
echo "pip install wheels failed. "
108+
echo "Please use 'sudo paddle' at the first time you use PaddlePaddle"
109+
echo "PaddlePaddle will install some python dependencies automatically."
110+
exit 1
111+
fi
112+
echo "Python dependencies are installed."
107113
fi
108114

109115
case "$1" in

0 commit comments

Comments
 (0)