Terminal Error : No module named speechbrain


I have been following the Speech Recognition From Scratch Tutorial …

I Have already installed speech brain and everything else using pycharm

pip install speechbrain

git clone https://github.com/speechbrain/speechbrain/
cd /content/speechbrain/
pip install -r requirements.txt
pip install -e .

in the step

cd speechbrain/templates/speech_recognition/Tokenizer
python train.py tokenizer.yaml

This command

python train.py tokenizer.yaml

gets me an error

ImportError: No module named speechbrain

I have also tried the same thing in the Normal terminal and I get the same result!

I have also tried

sudo python train.py tokenizer.yaml

And still got the same error.

Full error

Traceback (most recent call last):
  File "train.py", line 20, in <module>
    import speechbrain as sb
ImportError: No module named speechbrain

Hey Hi, is this in Google Colab ?

If so, yes, this is a known bug with Colab. It. is completely random and with have never been able to understand it. Just restarting the session should do …

1 Like

I’m not executing the command in google colab … I’m using pycharm community to execute the command on the terminal


OK … I think I found the solution to this problem.

I looked in the documentation and I found that if you are in the root file (speechbrain file)and ran

pytest tests
pytest --doctest-modules speechbrain

It will do a test run and will tell you what is the problems that you might run into,

For me it was cuda related problem

and here is what I did to fix it (I think I will run into more problems)

  1. I have installed conda
  2. I then installed cudatool kit in conda
conda install -c anaconda cudatoolkit
  1. I then installed yaml
pip install pyyaml

I ran the test again and now it’s working!

1 Like