Cannot import torchaudio with torch 1.1
See original GitHub issueI 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?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:24 (10 by maintainers)
Top Results From Across the Web
Cannot import torchaudio - audio - PyTorch Forums
I have an error when trying to import torchaudio: >>> import torchaudio ...
Read more >Developers - Cannot import torchaudio with torch 1.1 -
Coming soon: A brand new website interface for an even better experience!
Read more >How to resolve the hugging face error ImportError: cannot ...
SO related: Transformer: Error importing packages. "ImportError: cannot import name 'SAVE_STATE_WARNING' from 'torch.optim.lr_scheduler'"; HF ...
Read more >pytorch lightning import error - You.com | The AI Search ...
I guess this is an outdated issue as we have cut out TorchMetrics to a standalone package. Please, check out the latest PytorchLightning....
Read more >How to resolve the hugging face error ImportError: cannot ...
I was trying to use the ViTT transfomer. I got the following error with code: from pathlib import Path import torchvision from typing...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes this is a known issue. We are currently working on a fix and will update this when resolved
same issue, working after I check out d92de5b97fc6204db4b1e3ed20c03ac06f5d53f0