I’m trying to install PyTorch on a Jetson Xavier. I installed the following wheel using pip:
torch-1.10.0-cp36-cp36m-linux_aarch64.whl
The installation completes successfully, but when I try to import torch in Python, I get the following error: Traceback (most recent call last):
File “”, line 1, in
File “/home/nvidia/torch_env/lib/python3.6/site-packages/torch/init.py”, line 523, in
from ._tensor import Tensor
File “/home/nvidia/torch_env/lib/python3.6/site-packages/torch/_tensor.py”, line 14, in
from torch.overrides import (
File “/home/nvidia/torch_env/lib/python3.6/site-packages/torch/overrides.py”, line 32, in
from torch._C import (
ImportError: cannot import name ‘_has_torch_function’
Has anyone encountered this issue before or knows how to fix it?
Hi, thank you for your reply. However, installing PyTorch 1.10.0 in the native environment still produces the same issue:
nvidia@nvidia-desktop:~$ python3
Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license”, etc.
import torch
Traceback (most recent call last):
File “”, line 1, in
File “/home/nvidia/.local/lib/python3.6/site-packages/torch/init.py”, line 523, in
from ._tensor import Tensor
File “/home/nvidia/.local/lib/python3.6/site-packages/torch/_tensor.py”, line 14, in
from torch.overrides import (
File “/home/nvidia/.local/lib/python3.6/site-packages/torch/overrides.py”, line 32, in
from torch._C import (
ImportError: cannot import name ‘_has_torch_function’
On my device, only version 1.7.0 works correctly, but this version does not fulfill my needs. I am eager to know how to resolve this issue. Thank you.
I took your advice and uninstalled the system-level PyTorch using sudo pip3 uninstall torch, then installed a newer version. After that, the import error disappeared. It seems the issue was caused by Python picking up the old _C.so first while trying to load the newer Python files leading to a version mismatch and the _has_torch_function import error. Anyway, I really appreciate your help!