TorchText Import Error
kpriyanshu256 opened this issue · 2 comments
Hi,
I was trying to use the repo on Google Colab, but despite installing the requirements, I am getting the following error when running the run.py script.
Traceback (most recent call last):
File "pytorch-pQRNN/run.py", line 2, in
import pytorch_lightning as pl
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/init.py", line 28, in
from pytorch_lightning import metrics # noqa: E402
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/init.py", line 14, in
from pytorch_lightning.metrics.classification import ( # noqa: F401
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/classification/init.py", line 14, in
from pytorch_lightning.metrics.classification.accuracy import Accuracy # noqa: F401
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/classification/accuracy.py", line 18, in
from pytorch_lightning.metrics.functional.accuracy import _accuracy_compute, _accuracy_update
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/functional/init.py", line 14, in
from pytorch_lightning.metrics.functional.accuracy import accuracy # noqa: F401
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/functional/accuracy.py", line 18, in
from pytorch_lightning.metrics.classification.helpers import _input_format_classification, DataType
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/classification/helpers.py", line 19, in
from pytorch_lightning.metrics.utils import select_topk, to_onehot
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/metrics/utils.py", line 18, in
from pytorch_lightning.utilities import rank_zero_warn
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/init.py", line 18, in
from pytorch_lightning.utilities.apply_func import move_data_to_device # noqa: F401
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/apply_func.py", line 28, in
if _compare_version("torchtext", operator.ge, "0.9.0"):
File "/usr/local/lib/python3.7/dist-packages/pytorch_lightning/utilities/imports.py", line 52, in _compare_version
pkg = importlib.import_module(package)
File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.7/dist-packages/torchtext/init.py", line 5, in
from . import vocab
File "/usr/local/lib/python3.7/dist-packages/torchtext/vocab.py", line 13, in
from torchtext._torchtext import Vocab as VocabPybind
ImportError: /usr/local/lib/python3.7/dist-packages/torchtext/_torchtext.so: undefined symbol: _ZNK3c104Type14isSubtypeOfExtERKSt10shared_ptrIS0_EPSo
Hi @kpriyanshu256 You can either uninstall pre-installed torchtext, or upgrade all torch, torchtext and pytorch-lightning to the latest. Be sure to restart the runtime after the (un)installation, then you should be good.
Sorry for the late reply. I was able to run the code by only installing these dependencies on Google Colab.
pytorch-lightning
datasets
mmh3
rich