ModuleNotFoundError: No module named 'torchtext.legacy'
See original GitHub issueHi,
When trying to import deepmatcher, I am facing the error:
ModuleNotFoundError: No module named 'torchtext.legacy'
Steps to recreate:
!pip install deepmatcher --user
import deepmatcher as dm
Stacktrace:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-e017bad088ef> in <module>
----> 1 import deepmatcher as dm
~/.local/lib/python3.8/site-packages/deepmatcher/__init__.py in <module>
8 import sys
9
---> 10 from .data import process as data_process
11 from .models import modules
12 from .models.core import (MatchingModel, AttrSummarizer, WordContextualizer,
~/.local/lib/python3.8/site-packages/deepmatcher/data/__init__.py in <module>
----> 1 from .field import MatchingField, reset_vector_cache
2 from .dataset import MatchingDataset
3 from .iterator import MatchingIterator
4 from .process import process, process_unlabeled
5 from .dataset import split
~/.local/lib/python3.8/site-packages/deepmatcher/data/field.py in <module>
11 import fasttext
12 import torch
---> 13 from torchtext.legacy import data, vocab
14 from torchtext.utils import download_from_url
15 from urllib.request import urlretrieve
ModuleNotFoundError: No module named 'torchtext.legacy'
Please let me know how to fix this, or if you need more information.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7
Top Results From Across the Web
Modulenotfounderror: no module named torchtext.legacy
Modulenotfounderror : no module named torchtext.legacy error occurs because of directory structure change after 0.10.0 torchtext release.
Read more >I am trying to import:from torchtext.legacy.data import Field ...
legacy import data 8 ModuleNotFoundError: No module named 'torchtext.legacy'. I have tried it on both kaggle notebook and jupyter notebook and ...
Read more >No module named "torchtext.legacy" #2 - rooshenas/ebr_mt
I'm trying too use from torchtext.legacy import data in my jupyter notebook problem and no matter what I do I get, ModuleNotFoundError: No...
Read more >no module named torchtext.legacy ( Solved ) - Code the Best
legacy is one of them. It allows you to load the text data and do some manipulations on it. The modulenotfounderror comes because...
Read more >modulenotfounderror: no module named 'torchtext.legacy'
Solution 1: Install the torchtext module. The best way to solve this no module named torchtext.legacy is to install the torchtext module in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah this is likely because the latest version of torchtext may have removed the legacy module. I’ll fix the install dependencies to correct it. In the meantime, you could try reverting torchtext to an older release manually for now.
On Tue, Apr 19, 2022, 8:11 AM Jacob Celestine @.***> wrote:
Thanks! For now, I am using the
0.11.0
version of torchtext. Moving to0.12.0
seems to cause the issue. Please close the issue when you have made the required changes to the code.