Unable to build Pytorch with Python 3.10 and above
In the current code, python_nodot will only be defined if the previous if statement is satisfied. Otherwise, it would be empty and would not work for cases where Python version is 3.10 and above.
https://github.com/pytorch/builder/blob/d7ad1b3890642cd3a2ae66b2d690b8f249df82b2/manywheel/build_common.sh#L90
Example:
DESIRED_PYTHON=cp310-cp310
if [[ -n "$DESIRED_PYTHON" && "$DESIRED_PYTHON" != cp* ]]; then statement not met, so python_nodot is not defined. Then next if statement is not satisfied and hence go in the else statement. Hence, py_majmin=3.1, which gives error here https://github.com/pytorch/builder/blob/d7ad1b3890642cd3a2ae66b2d690b8f249df82b2/manywheel/build_common.sh#L464
if [[ ${python_nodot} -ge 310 ]]; then
py_majmin="${DESIRED_PYTHON:2:1}.${DESIRED_PYTHON:3:2}"
else
py_majmin="${DESIRED_PYTHON:2:1}.${DESIRED_PYTHON:3:1}"
fi
One solution I can think of is defining python_nodot before the python_nodot if else loop: python_nodot="$(echo ${DESIRED_PYTHON%%-*} | tr -cd '[:digit:]')"
cc @malfet
@ajindal1 not sure I understand the issue. PyTorch can be build for 3.10+, we run those builds every night.
Let me try to elaborate the issue and show the error I got. This can be reproduced by just changing the python version to 3.10 on this link.
Issue: python_nodot variable is only defined if this if statement is satisfied and executed. https://github.com/pytorch/builder/blob/beff0879e66e871dbaf3d1714ad3d19df20a70d2/manywheel/build_common.sh#L77
Otherwise, python_nodot is not defined and when it goes to the next if statement, it always goes in the else statement because python_nodot is empty. https://github.com/pytorch/builder/blob/beff0879e66e871dbaf3d1714ad3d19df20a70d2/manywheel/build_common.sh#L90
This will lead to py_majmin=3.1 instead of py_majmin=3.10. Which gives the below error.
++ installed_libraries=($(find "$pydir/lib/python${py_majmin}/site-packages/torch/" -name '*.so*'))
+++ find /opt/python/cp310-cp310/lib/python3.1/site-packages/torch/ -name '*.so*'
find: ‘/opt/python/cp310-cp310/lib/python3.1/site-packages/torch/’: No such file or directory