Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'dict' object has no attribute 'iteritems' #5

Open
talal-sen opened this issue Jan 29, 2021 · 5 comments
Open

AttributeError: 'dict' object has no attribute 'iteritems' #5

talal-sen opened this issue Jan 29, 2021 · 5 comments

Comments

@talal-sen
Copy link

Hi, I was able to install kaldi-lm-adpat. After running the command on my sentences.txt with the Zamia pretrained model, I got this error

0609 lm.arpa mymodel -w=/home/jupyter/lm_model -f
INFO:root:rm -rf =/home/jupyter/lm_model
INFO:root:copying dictionary and phoneme sets from original model...
INFO:root:creating skeleton destination model...
Traceback (most recent call last):
File "/opt/conda/bin/kaldi-adapt-lm", line 4, in
import('pkg_resources').run_script('kaldi-adapt-lm==0.1.4', 'kaldi-adapt-lm')
File "/opt/conda/lib/python3.7/site-packages/pkg_resources/init.py", line 665, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/opt/conda/lib/python3.7/site-packages/pkg_resources/init.py", line 1463, in run_script
exec(code, namespace, namespace)
File "/opt/conda/lib/python3.7/site-packages/kaldi_adapt_lm-0.1.4-py3.7.egg/EGG-INFO/scripts/kaldi-adapt-lm", line
93, in
kaldi_adapt_lm (kaldi_root, src_model_dir, lm_fn, work_dir, dst_model_name)
File "/opt/conda/lib/python3.7/site-packages/kaldi_adapt_lm-0.1.4-py3.7.egg/kaldiadaptlm/init.py", line 100, i
n kaldi_adapt_lm
misc.render_template ('%s/kaldi-path.sh.template' % tmpl_dir, '%s/path.sh' % work_dir, kaldi_root=kaldi_root)
File "/opt/conda/lib/python3.7/site-packages/py_nltools-0.5.0-py3.7.egg/nltools/misc.py", line 307, in render_temp
late
for key, value in kwargs.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

@svenha
Copy link

svenha commented Jan 29, 2021

Please check the Requirements section of this repo. For the iterItems problem, see e.g. http://docs.buildbot.net/0.9.4/developer/py3-compat.html
You can port this repo to Python 3 and share your results; or you must use Python 2.

@talal-sen
Copy link
Author

Thanks for the reply, how. do i ensure that this uses python 2 to run?

@talal-sen
Copy link
Author

I change the python path in vi /opt/conda/bin/kaldi-adapt-lm frpm the default python to python 2. Howver i am getting this error

kaldi-adapt-lm /home/jupyter/kaldi-generic-en-tdnn_fl-r20190609 lm.arpa mymodel -w=/home/jupyter/lm_model2 -f -v
Traceback (most recent call last):
File "/opt/conda/bin/kaldi-adapt-lm", line 4, in
import('pkg_resources').run_script('kaldi-adapt-lm==0.1.4', 'kaldi-adapt-lm')
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 3191, in
@_call_aside
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 3175, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 3204, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 583, in _build_master
ws.require(requires)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'kaldi-adapt-lm==0.1.4' distribution was not found and is required by the application

@svenha
Copy link

svenha commented Jan 29, 2021

You probably must repeat some preparation steps as needed. A fresh install after installing python-is-python2 sometimes work.

@talal-sen
Copy link
Author

I tried installing everything from scratch using python 2.7

sudo python2.7 setup.py install

running install
running bdist_egg
running egg_info
writing requirements to kaldi_adapt_lm.egg-info/requires.txt
writing kaldi_adapt_lm.egg-info/PKG-INFO
writing top-level names to kaldi_adapt_lm.egg-info/top_level.txt
writing dependency_links to kaldi_adapt_lm.egg-info/dependency_links.txt
reading manifest file 'kaldi_adapt_lm.egg-info/SOURCES.txt'
writing manifest file 'kaldi_adapt_lm.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/kaldiadaptlm
creating build/bdist.linux-x86_64/egg/kaldiadaptlm/templates
copying build/lib.linux-x86_64-2.7/kaldiadaptlm/templates/kaldi-cmd.sh -> build/bdist.linux-x86_64/egg/kaldiadaptlm/templates
copying build/lib.linux-x86_64-2.7/kaldiadaptlm/templates/kaldi-run-adaptation.sh -> build/bdist.linux-x86_64/egg/kaldiadaptlm/templates
copying build/lib.linux-x86_64-2.7/kaldiadaptlm/templates/kaldi-path.sh.template -> build/bdist.linux-x86_64/egg/kaldiadaptlm/templates
copying build/lib.linux-x86_64-2.7/kaldiadaptlm/templates/kaldi-model-dist.sh -> build/bdist.linux-x86_64/egg/kaldiadaptlm/templates
copying build/lib.linux-x86_64-2.7/kaldiadaptlm/init.py -> build/bdist.linux-x86_64/egg/kaldiadaptlm
byte-compiling build/bdist.linux-x86_64/egg/kaldiadaptlm/init.py to init.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
copying and adjusting kaldi-adapt-lm -> build/scripts-2.7
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/kaldi-adapt-lm -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/kaldi-adapt-lm to 755
copying kaldi_adapt_lm.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kaldi_adapt_lm.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kaldi_adapt_lm.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kaldi_adapt_lm.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kaldi_adapt_lm.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying kaldi_adapt_lm.egg-info/.ipynb_checkpoints/PKG-INFO-checkpoint -> build/bdist.linux-x86_64/egg/EGG-INFO/.ipynb_checkpoints
copying kaldi_adapt_lm.egg-info/.ipynb_checkpoints/SOURCES-checkpoint.txt -> build/bdist.linux-x86_64/egg/EGG-INFO/.ipynb_checkpoints
copying kaldi_adapt_lm.egg-info/.ipynb_checkpoints/dependency_links-checkpoint.txt -> build/bdist.linux-x86_64/egg/EGG-INFO/.ipynb_checkpoints
copying kaldi_adapt_lm.egg-info/.ipynb_checkpoints/requires-checkpoint.txt -> build/bdist.linux-x86_64/egg/EGG-INFO/.ipynb_checkpoints
copying kaldi_adapt_lm.egg-info/.ipynb_checkpoints/top_level-checkpoint.txt -> build/bdist.linux-x86_64/egg/EGG-INFO/.ipynb_checkpoints
zip_safe flag not set; analyzing archive contents...
kaldiadaptlm.init: module references file
creating 'dist/kaldi_adapt_lm-0.1.4-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing kaldi_adapt_lm-0.1.4-py2.7.egg
removing '/usr/local/lib/python2.7/dist-packages/kaldi_adapt_lm-0.1.4-py2.7.egg' (and everything under it)
creating /usr/local/lib/python2.7/dist-packages/kaldi_adapt_lm-0.1.4-py2.7.egg
Extracting kaldi_adapt_lm-0.1.4-py2.7.egg to /usr/local/lib/python2.7/dist-packages
kaldi-adapt-lm 0.1.4 is already the active version in easy-install.pth
Installing kaldi-adapt-lm script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/kaldi_adapt_lm-0.1.4-py2.7.egg
Processing dependencies for kaldi-adapt-lm==0.1.4
Searching for py-kaldi-asr
Reading https://pypi.org/simple/py-kaldi-asr/
Downloading https://files.pythonhosted.org/packages/b5/bb/0082185cfa67d63068358de9b1a65661c8dcdbe97e935809427d5881ea17/py-kaldi-asr-0.5.2.tar.gz#sha256=481c401c51ff48797a08e7eeec9ed3145a8600dc1b4699e41e26057794c49680
Best match: py-kaldi-asr 0.5.2
Processing py-kaldi-asr-0.5.2.tar.gz
Writing /tmp/easy_install-aNxuh7/py-kaldi-asr-0.5.2/setup.cfg
Running py-kaldi-asr-0.5.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-aNxuh7/py-kaldi-asr-0.5.2/egg-dist-tmp-LmZXmp
Traceback (most recent call last):
File "setup.py", line 29, in
include_package_data = True
File "/usr/lib/python2.7/dist-packages/setuptools/init.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 67, in run
self.do_egg_install()
File "/usr/lib/python2.7/dist-packages/setuptools/command/install.py", line 117, in do_egg_install
cmd.run()
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 443, in run
self.easy_install(spec, not self.no_deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 685, in easy_install
return self.install_item(None, spec, tmpdir, deps, True)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 732, in install_item
self.process_distribution(spec, dist, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 777, in process_distribution
[requirement], self.local_index, self.easy_install
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1065, in best_match
return self.obtain(req, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 1077, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-aNxuh7/py-kaldi-asr-0.5.2/setup.py", line 11, in
maintainer_email = 'guenter@zamia.org',
Exception: *** cython is needed to build this extension.

But cython is already installed

pip2 install cython
Requirement already satisfied: cython in /home/jupyter/.local/lib/python2.7/site-packages (0.29.21)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants