gooofy / zamia-speech

Open tools and data for cloudless automatic speech recognition
GNU Lesser General Public License v3.0
443 stars 84 forks source link

python3-kaldiasr : Depends: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed #91

Open edbir1 opened 4 years ago

edbir1 commented 4 years ago

I am mired down in version hell and inexperience. I can get the demo to run in python 2.7 python kaldi_decode_wav.py demo1.wav

Now to get it to operate when I new file shows up in a directory I installed watchdog.

pip install watchdog
Requirement already satisfied: watchdog in /usr/local/lib/python3.6/dist-packages (0.9.0) ...

But when I try to run it I get lib errors as it appears to have put the watchdog in python 3.6 .

ed@ed-VirtualBox:~/speech$ python kaldi_decode_wav2.py demo1.wav
Traceback (most recent call last):
  File "kaldi_decode_wav2.py", line 37, in <module>
    from watchdog.observers import Observer
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/__init__.py", line 63, in <module>
    from .inotify import InotifyObserver as Observer
  File "/usr/local/lib/python2.7/dist-packages/watchdog/observers/inotify.py", line 83, in <module>
    from watchdog.events import (
  File "/usr/local/lib/python2.7/dist-packages/watchdog/events.py", line 91, in <module>
    from pathtools.patterns import match_any_paths
ImportError: No module named pathtools.patterns
ed@ed-VirtualBox:~/speech$ pip install pathtools
Requirement already satisfied: pathtools in /usr/local/lib/python3.6/dist-packages (0.1.2)

If I change the script shebang to python3 and then run it with python3

#!/usr/bin/env python3

ed@ed-VirtualBox:~/speech$ python3 kaldi_decode_wav2.py demo1.wav
Traceback (most recent call last):
  File "kaldi_decode_wav2.py", line 36, in <module>
    from kaldiasr.nnet3 import KaldiNNet3OnlineModel, KaldiNNet3OnlineDecoder
ModuleNotFoundError: No module named 'kaldiasr'
...
So I wander the repository and find a python3 version and try to install it
...
sudo apt install ./python3-kaldiasr_0.5.2-1_amd64.deb 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'python3-kaldiasr' instead of './python3-kaldiasr_0.5.2-1_amd64.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-kaldiasr : Depends: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.

So now it appears that my version of python 3.6 is too new.

Any suggestions to these problems?

joazoa commented 4 years ago

you can install a specific version of python3, e.g. https://askubuntu.com/questions/682869/how-do-i-install-a-different-python-version-using-apt-get Or you can make sure pip points to the python2 version instead of 3 and install the watchdog again. (Python 2 and 3 happily coexist).

DataWorm commented 4 years ago

I recently tried to dockerize some stuff for raspberry pi and include kaldi. Usually I prefer working with python3 cause I see no point in using older versions if not neccessary. I also found that deadsnake repo, but apparently it does not work for armhf platform. So I tried downloading/building/installing an old python version manually. That seems to be fine, however when I try installing those packages like "python3-kaldiasr" via apt-get, it is moaning because of the missing python3 dependency (cause it was not installed as a deb package)...

Any clue why it does not permit newer python3 versions? Isn't there a (simple) way to make it work with latest version?