anhaidgroup/deepmatcher

Deepmatcher: No module named 'torchtext.legacy'

Opened this issue · 4 comments

Hi All

I am attempting to import Deepmatcher,but receiving following error
ModuleNotFoundError: No module named 'torchtext.legacy'

Code:

try:
import deepmatcher
except:
!pip install -qqq deepmatcher

Error Output:
ModuleNotFoundError Traceback (most recent call last)
in
----> 1 import deepmatcher as dm

~/.local/lib/python3.8/site-packages/deepmatcher/init.py in
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
----> 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
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'

Hi,

I'm having the same error. I executed:
pip install deepmatcher

Then executed:
import deepmatcher

And got the ModuleNotFoundError: No module named 'torchtext.legacy'

I have this versions (installed with pip)
torch==1.8.0
torchdata==0.6.1
torchtext==0.9.0

Could you please help me out with this issue?
Thanks

Hey good people.

So, the package is old (~2020), and the python version and libraries had changed A LOT since them.

For me to use the library I had to do some workarounds:

I create a VM to use old python version

I was using a VM with Ubuntu 20.04

Use a python version that was "current" around 2020

I used python 3.8 and it worked.

apt-get update
apt-get install python3-pip

You have to set the libs versions also to be the versions around 2020

Depending in with machine and OS, you may need to install more or less packages. In my case what I need to install:

python3.8 -m pip install setuptools==50.0.3 wheel==0.36.1 torch==1.8 torchtext==0.9
python3.8 -m pip install pybind11==2.6.1 numpy==1.18.0
python3.8 -m pip install fasttext pandas==1.2.0 scipy==1.6.0
python3.8 -m pip install deepmatcher

*I think it's importante for you to use the python3.X -m pip, because it'll install the packages in the right python path.

Import the library

After installing the packages I used:
python3.8

And imported the library:
import deepmatcher as dp

And that was that.

I would think, someone can pick up and make the upgrades.. I tried a bunch of stuff but couldnt get it working. If I make a breakthrough - will send pull request

I am still getting the error even if i downgrade the python version