Importing torchtext

Trying to import torch along with torchtext to download the WikiText-2 dataset.

torch version: 2.5.1
torchtext version: 0.18.0
platform: macOS (mps)

Not sure if its a compatibility error b/w torch versions or something.

Getting the following error:
OSError: dlopen(/anaconda3/envs/llm/lib/python3.9/site-packages/torchtext/lib/libtorchtext.so, 0x0006): Symbol not found: __ZN3c105ErrorC1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES7_PKv
Referenced from: /anaconda3/envs/llm/lib/python3.9/site-packages/torchtext/lib/libtorchtext.so
Expected in: /anaconda3/envs/llm/lib/python3.9/site-packages/torch/lib/libc10.dylib

torchtext is no longer maintained, and only compatible up to PyTorch version 2.3.0.

1 Like