Skip to content

Cannot import torchaudio with torch 1.1 #121

@f90

Description

@f90

I am trying to use torchaudio with torch 1.1.
It compiled successfully with Python 3.6, but when I want to import the torchaudio package, I get this error:

>>> import torchaudio
Traceback (most recent call last):
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torch/jit/annotations.py", line 95, in parse_type_line
    arg_ann = eval(arg_ann_str, _eval_env)
  File "<string>", line 1, in <module>
NameError: name 'Optional' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torchaudio-0.2-py3.6-linux-x86_64.egg/torchaudio/__init__.py", line 7, in <module>
    from torchaudio import transforms, datasets, kaldi_io, sox_effects, legacy
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torchaudio-0.2-py3.6-linux-x86_64.egg/torchaudio/transforms.py", line 6, in <module>
    from . import functional as F
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torchaudio-0.2-py3.6-linux-x86_64.egg/torchaudio/functional.py", line 108, in <module>
    @torch.jit.script
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torch/jit/__init__.py", line 824, in script
    fn = torch._C._jit_script_compile(ast, _rcb, get_default_args(obj))
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torch/jit/annotations.py", line 55, in get_signature
    return parse_type_line(type_line)
  File "/home/daniel/envs/pytorch-py3/lib/python3.6/site-packages/torch/jit/annotations.py", 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

It ran fine on torch 1.0 - maybe some problem with differing source code between torch 1.0 and 1.1?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions