ModuleNotFoundError: No module named 'ot'

2,105 views
Skip to first unread message

Tedo Vrbanec

unread,
Feb 18, 2023, 8:15:30 AM2/18/23
to Gensim
After execution return model.wv.wmdistance(item[0],item[1])
I have got an error:

  File "/usr/local/lib/python3.9/dist-packages/gensim/models/keyedvectors.py", line 955, in wmdistance
    from ot import emd2
ModuleNotFoundError: No module named 'ot'

I tried to install modul named ot with pip but:
ERROR: Could not find a version that satisfies the requirement ot
ERROR: No matching distribution found for ot

Any ideas? It looks like connected with gensim (which I have the latest).

Tedo Vrbanec

unread,
Feb 18, 2023, 10:26:30 AM2/18/23
to Gensim
It looks like one should install pot :((
Maybe to consider adding pot into gensim requirements?

Gordon Mohr

unread,
Feb 19, 2023, 2:26:47 PM2/19/23
to Gensim
In a few cases of methods/classes of optional functionality, Gensim leaves the decision to install extra required libraries up to the user.

There's not really a bright-line heuristic for guiding this decision. When the WMD functionality was new, it depended on a library (`pyemd`) that might've had some more platform limitations, and a lesser history of many-contributors/wide-review, than the current `POT`. That, and its newness, likely contributed to the choice to only import it when needed, and not declare it as an always-present requirement. 

The docs for `wmdistance()` try to be clear about this. 

It could be changed if the tradeoffs are good. Or the runtime error displayed could be improved to better-guide people to the exact package/docs that can help resolve the need.

- Gordon 

Tedo Vrbanec

unread,
Feb 21, 2023, 6:34:04 AM2/21/23
to Gensim
I see. Thank you!
Reply all
Reply to author
Forward
0 new messages