Details can be seen at https://github.com/pytorch/text/issues/1928
I actually have torch built from source and successfully installed. However, even if I have torchtext also successfully built from source and installed, I couldn’t import it and got the following ERROR:
➜ ~ python
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchtext as tt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/.local/lib/python3.10/site-packages/torchtext/__init__.py", line 6, in <module>
from torchtext import _extension # noqa: F401
File "~/.local/lib/python3.10/site-packages/torchtext/_extension.py", line 64, in <module>
_init_extension()
File "~/.local/lib/python3.10/site-packages/torchtext/_extension.py", line 58, in _init_extension
_load_lib("libtorchtext")
File "~/.local/lib/python3.10/site-packages/torchtext/_extension.py", line 50, in _load_lib
torch.ops.load_library(path)
File "~/.local/lib/python3.10/site-packages/torch/_ops.py", line 568, in load_library
ctypes.CDLL(path)
File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: ~/.local/lib/python3.10/site-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZTVN5torch8autograd12AutogradMetaE
>>>
My torch and torchtext are respectively installed as:
➜ ~ pip show torch
Name: torch
Version: 1.13.0a0+git71dddec
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: ~/.local/lib/python3.10/site-packages
Requires: typing-extensions
Required-by: functorch, lpips, thop, timm, torchdata, torchtext, torchvision
➜ ~ pip show torchtext
Name: torchtext
Version: 0.14.0a0+3f9c349
Summary: Text utilities and datasets for PyTorch
Home-page: https://github.com/pytorch/text
Author: PyTorch core devs and James Bradbury
Author-email: jekbradbury@gmail.com
License: BSD
Location: ~/.local/lib/python3.10/site-packages
Requires: numpy, requests, torch, tqdm
Required-by:
Can anybody give me a hand please??