ModuleNotFoundError: No module named 'torchaudio.prototype'
See original GitHub issue🐛 Describe the bug
Having issues getting the Streamer to import. Have tried importing it like this from torchaudio.prototype.io.streamer import Streamer in folders independent of my cloned audio repo. In this case I had torchaudio installed as a pip dependency, however it seemed like it was possibly trying to reference my local audio repo. I was using torch 1.11.0 and torchaudio 0.11.0
Error:
ModuleNotFoundError: No module named 'torchaudio.prototype
Similarly I’ve tried removing the pip torchaudio dependency and trying to run online_asr_tutorial.py from its location in the audio repository and I still get the same issue.
ModuleNotFoundError: No module named 'torchaudio.prototype
I tried adding
import sys sys.path.append(‘…/…/’)
before the torchaudio import in my local copy of online_asr_tutorial.py under the audio repository but I then encountered this.
/home/tand/Projects/audio/examples/tutorials/../../torchaudio/_extension.py:58: UserWarning: torchaudio C++ extension is not available.
warnings.warn("torchaudio C++ extension is not available.")
1.11.0+cu102
0.12.0a0+4b47412
Traceback (most recent call last):
File "online_asr_tutorial.py", line 57, in <module>
from torchaudio.prototype.io import Streamer
File "/home/tand/Projects/audio/examples/tutorials/../../torchaudio/prototype/io/__init__.py", line 5, in <module>
torch.ops.torchaudio.ffmpeg_init()
File "/home/tand/.local/lib/python3.8/site-packages/torch/_ops.py", line 167, in __getattr__
op = torch._C._jit_get_operation(qualified_op_name)
RuntimeError: No such operator torchaudio::ffmpeg_init
Running online_asr_tutorial.py in google colab also gave the same error (with no file modification):
Reading package lists... Done
1.10.0+cu111
0.10.0+cu111
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
[<ipython-input-2-fa57ae3dbf9a>](https://localhost:8080/#) in <module>()
53 print(torchaudio.__version__)
54
---> 55 from torchaudio.prototype.io import Streamer
56
57 ######################################################################
ModuleNotFoundError: No module named 'torchaudio.prototype'
Versions
Collecting environment information… PyTorch version: 1.11.0+cu102 Is debug build: False CUDA used to build PyTorch: 10.2 ROCM used to build PyTorch: N/A
OS: Ubuntu 20.04.2 LTS (x86_64) GCC version: (Ubuntu 8.4.0-3ubuntu2) 8.4.0 Clang version: Could not collect CMake version: version 3.22.2 Libc version: glibc-2.31
Python version: 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] (64-bit runtime) Python platform: Linux-5.4.0-100-generic-x86_64-with-glibc2.29 Is CUDA available: True CUDA runtime version: 10.2.89 GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2080 Ti Nvidia driver version: 470.103.01 cuDNN version: /usr/local/cuda-10.2/targets/x86_64-linux/lib/libcudnn.so.7.6.5 HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True
Versions of relevant libraries:
[pip3] numpy==1.22.2
[pip3] pytorch-ignite==0.4.8
[pip3] pytorch-lightning==1.5.10
[pip3] torch==1.11.0
[pip3] torchmetrics==0.7.2
[pip3] torchvision==0.11.2
[conda] blas 1.0 mkl
[conda] cudatoolkit 10.2.89 hfd86e86_1
[conda] mkl 2021.4.0 h06a4308_640
[conda] mkl-service 2.4.0 py38h7f8727e_0
[conda] mkl_fft 1.3.1 py38hd3c417c_0
[conda] mkl_random 1.2.2 py38h51133e4_0
[conda] numpy 1.20.3 py38hf144106_0
[conda] numpy-base 1.20.3 py38h74d4b33_0
[conda] pytorch 1.10.2 py3.8_cuda10.2_cudnn7.6.5_0 pytorch
[conda] pytorch-mutex 1.0 cuda pytorch
[conda] torchaudio 0.10.2 py38_cu102 pytorch
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Related StackOverflow Question
@EdwinYam I see. The prototype modules are not imported automatically. Thus one has to explicitly import it. It’s described here https://pytorch.org/audio/main/prototype.html#torchaudio-prototype .
I encountered below error
[ModuleNotFoundError: No module named 'torchaudio.prototype'](https://github.com/pytorch/audio/issues/2277#)I figured it out by filling up the empty init.py in torchaudio/prototype