Description
If you have torch=1.1.0 and you install torchaudio>v0.2.0, you get
NameError: name 'Optional' is not defined
which means you have to upgrade torch>1.1.0 because Optional was added to jit after 1.1.0.
After you install an upgraded torch, and you finish installation of torchaudio it will not overwrite _torch_sox.cpython-36m-x86_64-linux-gnu.so. Thus it will not do the full compilation with the new torch. The indication of a full compilation is seeing building '_torch_sox' extension
or gcc/g++
during python setup.py install/develop
.
When you try to import torchaudio, you get
ImportError: ...audio/_torch_sox.cpython-36m-x86_64-linux-gnu.so:
undefined symbol: _ZN2at19NonVariableTypeMode10is_enabledEv
The solution is to run python setup.py clean --all
and then re-compiling torchaudio with the new torch. This removes the build/dist which forces a full compilation that overwrites the _torch_sox.cpython-...-gnu.so with the correct file. Someone suggested that this does not always work so it would be nice if someone posts their setup.