Dr. Prof. Patrick
Dr. Prof. Patrick

Reputation: 1374

Jupyter doesn't recognize torchaudio

I am trying to install torchaudio to use in a Jupyter notebook but when i import it i get the error:

ModuleNotFoundError: No module named 'torchaudio'

I tried to import it in a .py file that the notebook uses but to with no success. I thought maybe it wasnt installed properly but when i try to install it using pip install torchaudio i get "requirement already satisfied".

Im lost, how can i import it successfully?

Upvotes: 2

Views: 8301

Answers (2)

prosti
prosti

Reputation: 46311

pip install torchaudio

should return:

Collecting torchaudio
  Downloading https://files.pythonhosted.org/packages/96/34/c651430dea231e382ddf2eb5773239bf4885d9528f640a4ef39b12894cb8/torchaudio-0.6.0-cp36-cp36m-manylinux1_x86_64.whl (6.7MB)

     |████████████████████████████████| 6.7MB 2.4MB/s 
Requirement already satisfied: torch==1.6.0 in /usr/local/lib/python3.6/dist-packages (from torchaudio) (1.6.0+cu101)
Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from torch==1.6.0->torchaudio) (0.16.0)
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from torch==1.6.0->torchaudio) (1.18.5)
Installing collected packages: torchaudio
Successfully installed torchaudio-0.6.0

And everything should work as expected.

Upvotes: 4

Douglas M. Souza
Douglas M. Souza

Reputation: 11

Check if you have jupyter installed on your virual environment (where torchaudio is installed). If you do not have, it is likely that you're launching jupyter from your root env and therefore, jupyter is using your root env (which do not have torchaudio installed)

This is a very common mistake. You can solve by pip installing jupyter in the env that torchaudio is installed and launching jupyter from there.

You can always check which jupyter you're launching by running the command:

which jupyter

Upvotes: 0

Related Questions