8000 Colab TPU Wheel Pytorch XLA 1.13 Python 3.8 · Issue #4820 · pytorch/xla · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Colab TPU Wheel Pytorch XLA 1.13 Python 3.8 #4820

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

Open
mfatih7 opened this issue Mar 25, 2023 · 7 comments
Open

Colab TPU Wheel Pytorch XLA 1.13 Python 3.8 #4820

mfatih7 opened this issue Mar 25, 2023 · 7 comments
Labels
install PyTorch/XLA installation related issues.

Comments

@mfatih7
Copy link
mfatih7 commented Mar 25, 2023

I am trying to run my training scripts with Pytorch XLA 1.13.
Since Pytorch XLA 1.13 does not have Python 3.9 wheel and
COLAB Virtual Machines are updated to Python 3.9
I need to downgrade COLAB VM to Python3.8.

Here is the notebook script I use and the error I get

!update-alternatives --set python3 /usr/bin/python3.8
!apt-get install pip

%cd /content/drive/MyDrive/
!pip install -r requirements.txt
%cd /content/

!pip install cloud-tpu-client==0.10
!pip install torch==1.13.0
!pip install torchvision==0.15.1
!pip install https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-1.13-cp38-cp38-linux_x86_64.whl

%cd /content/drive/MyDrive/00_Runs/

!python runTrain_TPU_multi.py
  File "/usr/local/lib/python3.8/dist-packages/torch_xla/__init__.py", line 158, in <module>
    from ._patched_functions import _apply_patches
  File "/usr/local/lib/python3.8/dist-packages/torch_xla/_patched_functions.py", line 4, in <module>
    from torch._six import inf
ModuleNotFoundError: No module named 'torch._six'

What can I do?

@mfatih7
Copy link
Author
mfatih7 commented Mar 25, 2023

Changing source files as stated here is not practical.

@mfatih7
Copy link
Author
mfatih7 commented Mar 25, 2023

For Google Cloud TPU Virtual Machine, it is still possible to run pytorch 1.13 and pytorch_xla 1.13 with the following initialization.

cd /usr/share/
sudo git clone -b release/1.13 --recursive https://github.com/pytorch/pytorch 
cd pytorch/
sudo git clone -b r1.13 --recursive https://github.com/pytorch/xla.git
cd xla/
yes | sudo pip3 uninstall torch_xla
yes | sudo pip3 uninstall torch
yes | sudo pip3 uninstall torch_vision
sudo pip3 install torch==1.13.0
sudo pip3 install torchvision==0.14.0
sudo pip3 install https://storage.googleapis.com/tpu-pytorch/wheels/tpuvm/torch_xla-1.13-cp38-cp38-linux_x86_64.whl
sudo rm -rf /usr/local/lib/python3.8/dist-packages/libtpu*
sudo pip3 install torch_xla[tpuvm]

@vanbasten23
Copy link
Collaborator

Pytorch/XLA 2.0 has been released and it works with the current colab (py 3.9). Is it possible for you to use Pytorch/XLA 2.0?

@mfatih7
Copy link
Author
mfatih7 commented Apr 5, 2023

@vanbasten23

You can use Pytorch XLA 2.0 with Python 3.9 and Pytorch 2.0

@babloogpb1
Copy link

I'm getting this error when I tried importing torch in a .py script using Pytorch xla 2.0, Pytorch 2.0 on Python 3.9 colab instance. But it's working when importing in a cell.

OSError: libmkl_intel_lp64.so.1: cannot open shared object file: No such file or directory

@JackCaoG
Copy link
Collaborator

@babloogpb1
Copy link

Thanks for the help, I've tried that as well and it didn't work either. But when I installed the missing package libomp.so using apt-get install libomp-dev libopenblas-dev and followed the steps in that link, it's giving me a different error now.

ImportError: /usr/local/lib/python3.9/dist-packages/torch/lib/libtorch_cpu.so: undefined symbol: cblas_sgem_pack_get_size

@ysiraichi ysiraichi added the install PyTorch/XLA installation related issues. label May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
install PyTorch/XLA installation related issues.
Projects
None yet
Development

No branches or pull requests

5 participants
0