Skip to content

import torchtext fails #2283

@JuanVargas

Description

@JuanVargas

🐛 Bug

Today I installed torchtext in my Linux Ubuntu. When I tried to import torchtext into python, torchtext failed.

Details

  1. Ubuntu 24.04.1 LTS

  2. Python 3.12.3

  3. PyTorch Version 2.5.1+cu124 (running fine)

  4. During the torchtext install I saw messages suggesting that the version is 0.18, which according to what I read, is the last one to be supported.

  5. The error messages I get when I issue the command "import torchtex" are below.

  6. QUESTION: Given that torchtext will not be supported any more, is there an alternative API for text processing in PyTorch that will take the role of torchtext?

import torchtext
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/drv3/hm3/code/python/torch/lib/python3.12/site-packages/torchtext/__init__.py", line 18, in <module>
    from torchtext import _extension  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/drv3/hm3/code/python/torch/lib/python3.12/site-packages/torchtext/_extension.py", line 64, in <module>
    _init_extension()
  File "/drv3/hm3/code/python/torch/lib/python3.12/site-packages/torchtext/_extension.py", line 58, in _init_extension
    _load_lib("libtorchtext")
  File "/drv3/hm3/code/python/torch/lib/python3.12/site-packages/torchtext/_extension.py", line 50, in _load_lib
    torch.ops.load_library(path)
  File "/drv3/hm3/code/python/torch/lib/python3.12/site-packages/torch/_ops.py", line 1350, in load_library
    ctypes.CDLL(path)
  File "/usr/lib/python3.12/ctypes/__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions