question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

undefined symbol when importing torchaudio with pytorch

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
mthrokcommented, Mar 10, 2021

@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.

4reactions
alireza-hariricommented, Jun 25, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Undefined symbol pytorch 1.7.0 and above
Usually you would get this error message if you are trying to import custom extensions before importing PyTorch, which doesn't seem to be...
Read more >
Error importing Torchaudio - audio - PyTorch Forums
Hi all, I can't import Torchaudio, this is my setup: macOS ... python3.10/site-packages/torchaudio/lib/libtorchaudio.so, 0x0006): Symbol not ...
Read more >
FAQ — PyTorch master documentation
Undefined symbol errors from PyTorch/ATen ... Fix: The fix is to import torch before you import your extension. This will make the symbols...
Read more >
Successfully built torchaudio but failed to load - PyTorch Forums
_name, mode) OSError: ~/.local/lib/python3.10/site-packages/torchaudio/lib/libtorchaudio.so: undefined symbol: gsm_create.
Read more >
Torchaudio and torchtext installed but failed to import - audio
import torch >>> import torchaudio as ta Traceback (most recent call last): File "<stdin>", ... undefined symbol: __kmpc_reduce_nowait.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found