Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build Pytorch with Python 3.10 and above #1390

Open
ajindal1 opened this issue Apr 21, 2023 · 2 comments
Open

Unable to build Pytorch with Python 3.10 and above #1390

ajindal1 opened this issue Apr 21, 2023 · 2 comments

Comments

@ajindal1
Copy link

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.

if [[ ${python_nodot} -ge 310 ]]; then

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

installed_libraries=($(find "$pydir/lib/python${py_majmin}/site-packages/torch/" -name '*.so*'))

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

@malfet
Copy link
Contributor

malfet commented Apr 21, 2023

@ajindal1 not sure I understand the issue. PyTorch can be build for 3.10+, we run those builds every night.

@ajindal1
Copy link
Author

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.

if [[ -n "$DESIRED_PYTHON" && "$DESIRED_PYTHON" != cp* ]]; then

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.

if [[ ${python_nodot} -ge 310 ]]; then

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants