Error occurred when I tried to import torchaudio

I installed torchaudio according to the instruction by Nevertheless, when I tried to import torchaudio, the following error message popped up:

Traceback (most recent call last):
File “”, line 1, in
import torchaudio
File “/Users/q7/Desktop/Wavenet/audio-master/torchaudio/”, line 7, in
from torchaudio import transforms, datasets, kaldi_io, sox_effects, legacy, compliance
File “/Users/q7/Desktop/Wavenet/audio-master/torchaudio/”, line 6, in
from . import functional as F
File “/Users/q7/Desktop/Wavenet/audio-master/torchaudio/”, line 108, in
File “/anaconda3/lib/python3.7/site-packages/torch/jit/”, line 824, in script
fn = torch._C._jit_script_compile(ast, _rcb, get_default_args(obj))
File “/anaconda3/lib/python3.7/site-packages/torch/jit/”, line 55, in get_signature
return parse_type_line(type_line)
File “/anaconda3/lib/python3.7/site-packages/torch/jit/”, line 97, in parse_type_line
raise RuntimeError(“Failed to parse the argument list of a type annotation: {}”.format(str(e)))
RuntimeError: Failed to parse the argument list of a type annotation: name ‘Optional’ is not defined

Can someone propose a solution? Thanks a lot.

I am having the same problem. Using torch 1.1.0.

1 Like

There was bad commit in torchaudio. Solution: old version with pytorch 1.0.
pip3 install git+

Any other alternative?
This fails on current version
transform = torchaudio.transforms.DownmixMono(channels_first=True)
__init__() got an unexpected keyword argument 'channels_first'

The __init__ method just contains a pass statement.