coqui-ai / STT

🐸STT - The deep learning toolkit for Speech-to-Text. Training and deploying STT models has never been so easy.
https://coqui.ai
Mozilla Public License 2.0
2.23k stars 270 forks source link

Bug: "import stt" works in notebook but not in bash command #2343

Closed stimsonc closed 1 year ago

stimsonc commented 1 year ago

After pip install stt when I try to run the bash command stt --model --scorer --audio, I get stt: command not found. But when I run import stt in a Jupyter notebook it runs fine and I can transcribe files.

wasertech commented 1 year ago

There is so much wrong here. Let's pick up at the beginning.

After pip install stt ...

This is not helping us understand what command you really typed. When I type pip install stt in a shell, it will use my current environment to interpret what the heck does pip mean. With my configuration it is been interpreted like so: /usr/bin/pip install stt. On my system /usr/bin/pip is just an executable python script that looks like so:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal.cli.main import main
if __name__ == "__main__":
    sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
    sys.exit(main())

The shabang #!/usr/bin/python means that pip uses by default /usr/bin/python which on my system is just an alias to /usr/bin/python3.10.

❯ file /usr/bin/python
/usr/bin/python: symbolic link to python3
❯ file /usr/bin/python3
/usr/bin/python3: symbolic link to python3.10
❯ file /usr/bin/python3.10
/usr/bin/python3.10: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=56989432ace73d863c0fc4c2b44ea41ea895a75a, for GNU/Linux 4.4.0, stripped

If I would have been in a virtual environment, it would be using another python and another pip with a different site_packages/ directory.

Similarly, when you run stt --model *.tflite --scorer *.scorer --audio *.wav, you actualy are looking in your $PATH for a file named stt. On my system:

❯ which stt
/home/waser/.local/bin/stt
❯ file /home/waser/.local/bin/stt
/home/waser/.local/bin/stt: Python script, ASCII text executable

If you did pip install stt inside a virtual environment but you try to run the command inside your system environment it will produce the results you know: zsh: stt: command not found.

Since it's not an issue with STT but rather a miscommunication between you and your system I am going to close this issue.