audio: undefined symbol when importing torchaudio with pytorch

Hi, When importing torchaudio with pytorch 0.4.1 I get an undefined symbol. It does however work with v0.4.0. audio version: 7314b36

Successfully installed numpy-1.15.0 torch-cpu-0.4.1 torchaudio-0.1
(test_venv) [~]$ python -c "import torchaudio;"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "test_venv/lib/python3.6/site-packages/torchaudio/__init__.py", line 4, in <module>
    import _torch_sox
ImportError: test_venv/lib/python3.6/site-packages/_torch_sox.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2at5ErrorC1ENS_14SourceLocationESs

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 16
  • Comments: 15 (2 by maintainers)

Most upvoted comments

using -U option simply solved problem for me pip install -U torch torchaudio --no-cache-dir

@mthrok Thank you, this was indeed the issue. It was not the versions, but the channel of the conda package.

The release of PyTorch 1.8.0 was released together with the announcement of TorchAudio 0.8.0, so I would assume that these 2 versions would work together:

However, checking conda list:

pytorch                   1.8.0           cpu_py38he614459_0    conda-forge
torchaudio                0.8.0                      py38    pytorch

That shouldn’t be the CPU version from conda-forge…

I also see an env inconsistency:

$ conda install pytorch -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: - 
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - pytorch/linux-64::torchaudio==0.8.0=py38
  - conda-forge/linux-64::cudatoolkit==11.1.1=h6406543_8
  - conda-forge/linux-64::pytorch==1.8.0=cpu_py38he614459_0
  - pytorch/linux-64::torchvision==0.9.0=py38_cu111
  - conda-forge/noarch::pytorch-lightning==1.1.8=pyhd8ed1ab_0
done

To solve it, I reversed the channel priority in my environment.yml:

channels:
  - defaults
  - pytorch
  - conda-forge

pytorch above conda-forge means that pytorch channel is prioritized (if my understanding is correct).

@NumesSanguis PyTorch 1.8.0 and torchaudio 0.8.0 work together. In fact PyTorch 1.8.0 is a strict requirement for torchaudio 0.8.0. For conda, pytorch channel is the official distribution channel, but conda-forge is not and we do not know how the packages in conda-forge are maintained. I guess in your case, things got mixed up. Glad to hear that now it’s working.

Interested in the solution to this problem as well.

@mthrok Thank you, this was indeed the issue. It was not the versions, but the channel of the conda package.

The release of PyTorch 1.8.0 was released together with the announcement of TorchAudio 0.8.0, so I would assume that these 2 versions would work together:

However, checking conda list:

pytorch                   1.8.0           cpu_py38he614459_0    conda-forge
torchaudio                0.8.0                      py38    pytorch

That shouldn’t be the CPU version from conda-forge…

I also see an env inconsistency:

$ conda install pytorch -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: - 
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - pytorch/linux-64::torchaudio==0.8.0=py38
  - conda-forge/linux-64::cudatoolkit==11.1.1=h6406543_8
  - conda-forge/linux-64::pytorch==1.8.0=cpu_py38he614459_0
  - pytorch/linux-64::torchvision==0.9.0=py38_cu111
  - conda-forge/noarch::pytorch-lightning==1.1.8=pyhd8ed1ab_0
done

To solve it, I reversed the channel priority in my environment.yml:

channels:
  - defaults
  - pytorch
  - conda-forge

pytorch above conda-forge means that pytorch channel is prioritized (if my understanding is correct).