question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ModuleNotFoundError: No module named 'torchtext.legacy'

See original GitHub issue

Hi,

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

3reactions
sidharthmscommented, Apr 19, 2022

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:

Hi,

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.

— Reply to this email directly, view it on GitHub https://github.com/anhaidgroup/deepmatcher/issues/96, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABWE5ZMBPX6W6N2FME7GAMTVF3EKZANCNFSM5TZFPG3A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

1reaction
jacobcelescommented, Apr 19, 2022

Thanks! For now, I am using the 0.11.0 version of torchtext. Moving to 0.12.0 seems to cause the issue. Please close the issue when you have made the required changes to the code.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found