Python import common lib error.

1,643 views
Skip to first unread message

Cemil Demir

unread,
Mar 5, 2018, 4:49:25 AM3/5/18
to kaldi...@googlegroups.com
Hi,
I know, there is a closed similar issue (issue number 1375) about this problem.

But, i think, the problem is not solved completely.

I used the latest version and I got the error below by running "run_tdnn_7n.sh" script in "egs/swbd/local/chain/tuning" directory.

I got the error:

File "steps/nnet3/chain/train.py", line 19, in <module>
    import libs.nnet3.train.common as common_train_lib
  File "steps/libs/__init__.py", line 9, in <module>
    import common
ModuleNotFoundError: No module named 'common'

Do you have any suggestion solving this problem?

Thanks.

--

Daniel Povey

unread,
Mar 5, 2018, 3:35:33 PM3/5/18
to kaldi-help, Vimal Manohar
Vimal, can you please look into this?
I suspect it has something to do with python3 disabling something called relative imports, but I don't 100% understand these types of issues.


--
Go to http://kaldi-asr.org/forums.html find out how to join
---
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+unsubscribe@googlegroups.com.
To post to this group, send email to kaldi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kaldi-help/CAPgd1btEPTVgNXYWbjQ%2BU42Wqk8E%2Bf4nO6-hZsQAY2eawLBwpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Povey

unread,
Mar 5, 2018, 8:22:00 PM3/5/18
to kaldi-help, Vimal Manohar, Daniel Galvez
Daniel, can you give us a hint about the likely fix?

Vimal Manohar

unread,
Mar 6, 2018, 2:32:02 AM3/6/18
to dpo...@gmail.com, kaldi-help, Daniel Galvez
The issue is related to this : https://www.python.org/dev/peps/pep-0328/
I have not yet found a fix.

To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+...@googlegroups.com.


--
Vimal Manohar
PhD Student
Electrical & Computer Engineering
Johns Hopkins University

Vimal Manohar

unread,
Mar 6, 2018, 2:37:36 AM3/6/18
to dpo...@gmail.com, kaldi-help, Daniel Galvez
I believe one solution is to replace all the `import common` etc. with `from . import common` and so on. It seems to work.

Vimal

Daniel Povey

unread,
Mar 6, 2018, 12:15:51 PM3/6/18
to Vimal Manohar, kaldi-help, Daniel Galvez
From this
it looks like you have to change
from base import BaseThing
to:
from .base import BaseThing

We could test this in python2.7 by adding
from __future__ import absolute_import

Dan



To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+unsubscribe@googlegroups.com.
--
Vimal Manohar
PhD Student
Electrical & Computer Engineering
Johns Hopkins University

Daniel Povey

unread,
Mar 7, 2018, 1:57:10 PM3/7/18
to Vimal Manohar, Cemil Demir, kaldi-help, Daniel Galvez
Cecil, can you try just removing the following lines

import common

__all__ = ["common"]

from __init__.py in steps/libs/ ?
As far as I can tell, no-one is ever doing "import libs" so that stuff may not be needed at all.
I really don't know what the best practices are with those __init__.py files, but I do notice that in subdirectories of that directory, the __init__.py files are empty.

Dan

Daniel Povey

unread,
Mar 7, 2018, 2:07:46 PM3/7/18
to Vimal Manohar, Cemil Demir, kaldi-help, Daniel Galvez
Wait, that won't work.  I'm working on a fix.

Daniel Povey

unread,
Mar 7, 2018, 2:15:35 PM3/7/18
to Vimal Manohar, Cemil Demir, kaldi-help, Daniel Galvez
OK, I've merged a fix.
Cemil: the reason we didn't have this problem yet is presumably that no-one was previously running Kaldi's neural-net training on a system where python is python3.  So you may hit further bugs.  We will fix them though.
Dan
Reply all
Reply to author
Forward
0 new messages