Opennmt-py: No module named 'onmt'

Created on 25 Jul 2018  路  4Comments  路  Source: OpenNMT/OpenNMT-py

I tried to follow the tutorial, but this error keeps popping up, I thought I found the solution for it, but it turns out I didn't:
when running preprocess.py:

from onmt.utils.logging import init_logger, logger

ModuleNotFoundError: No module named 'onmt'

Most helpful comment

you don't have to do this if:
1) you install with setup.py
or
2) you export PYTHONPATH to the current dir of the repo

All 4 comments

I've had this when following the pretrained embeddings tutorial where it says to run:

./tools/embeddings_to_torch.py -emb_file "glove_dir/glove.6B.100d.txt" \
-dict_file "data/data.vocab.pt" \
-output_file "data/embeddings"

Move ./tools/embeddings_to_torch.py to ./embeddings_to_torch.py (i.e. the top-level directory) and it works.

you don't have to do this if:
1) you install with setup.py
or
2) you export PYTHONPATH to the current dir of the repo

Thank you both, there was a problem with the path, because i use Anaconda it was set to the wrong directory. (...anaconda instead of ...Anaconda3)

@jbecke
Try
python -m tools.embeddings_to_torch
instead of
./tools/embeddings_to_torch.py

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kakkartushar1 picture kakkartushar1  路  5Comments

Bachstelze picture Bachstelze  路  3Comments

KelleyYin picture KelleyYin  路  6Comments

mrpega picture mrpega  路  3Comments

mzeidhassan picture mzeidhassan  路  4Comments