Closed homink closed 5 years ago
Hi @homink,
Hmm, it's odd. I guess the importlib has some issue to load modules. What OS are you using? Could you check where the segfault is generated by following this?
CentOS 7. I found that importing _torch_sox gives error in my system. The following links could be similar symptoms but reinstalling pytorch/audio with pip or cloning&install doesn't work.
https://github.com/pytorch/audio/issues/62 https://github.com/pytorch/audio/issues/68
cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
python train.py deepspeech_ctc --data-path /home/kwon/EXP/ted_pytorch
models: convnet deepspeech_ce resnet_ce ssvae las capsule1 capsule2 deepspeech_var densenet_ctc resnet_ctc densenet resnet_split resnet_split_ce deepspeech_ctc
input model: deepspeech_ctc
trying importlib.import_module(f"asr.models.{model}")
Fatal Python error: Segmentation fault
Current thread 0x00007f2d90162740 (most recent call first):
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 922 in create_module
File "<frozen importlib._bootstrap>", line 571 in module_from_spec
File "<frozen importlib._bootstrap>", line 658 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "/home/kwon/anaconda3/lib/python3.6/site-packages/torchaudio/__init__.py", line 5 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "/home/kwon/3rdParty/pytorch-asr/asr/utils/dataset.py", line 15 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "/home/kwon/3rdParty/pytorch-asr/asr/models/deepspeech_ctc/train.py", line 10 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "/home/kwon/3rdParty/pytorch-asr/asr/models/deepspeech_ctc/__init__.py", line 1 in <module>
File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
File "<frozen importlib._bootstrap_external>", line 678 in exec_module
File "<frozen importlib._bootstrap>", line 665 in _load_unlocked
File "<frozen importlib._bootstrap>", line 955 in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 971 in _find_and_load
File "<frozen importlib._bootstrap>", line 994 in _gcd_import
File "/home/kwon/anaconda3/lib/python3.6/importlib/__init__.py", line 126 in import_module
File "train.py", line 25 in <module>
Segmentation fault (core dumped)
echo $CPLUS_INCLUDE_PATH
/usr/include/sox:
which sox
/usr/bin/sox
which th
/usr/local/torch/install/bin/th
ls /home/kwon/anaconda3/lib/python3.6/site-packages/*.so -hal
-rwxr-xr-x 2 kwon domain users 185K Sep 17 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/_cffi_backend.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 2 kwon domain users 539K Sep 18 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/gmpy2.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 2 kwon domain users 36K Sep 18 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/greenlet.cpython-36m-x86_64-linux-gnu.so
-rwxrwxr-x 2 kwon domain users 93K Jul 5 2018 /home/kwon/anaconda3/lib/python3.6/site-packages/pycosat.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 2 kwon domain users 137K Sep 18 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/pycurl.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 2 kwon domain users 154K Sep 18 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/pyodbc.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 2 kwon domain users 121K Sep 18 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/sip.so
-rwxr-xr-x 1 kwon domain users 6.0M Jan 7 11:07 /home/kwon/anaconda3/lib/python3.6/site-packages/_torch_sox.cpython-36m-x86_64-linux-gnu.so
-rwxr-xr-x 2 kwon domain users 228K Sep 18 2017 /home/kwon/anaconda3/lib/python3.6/site-packages/_yaml.cpython-36m-x86_64-linux-gnu.so
python
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import _torch_sox
Segmentation fault (core dumped)
python
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 13 2017, 12:02:49)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _torch_sox
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /home/kwon/anaconda3/lib/python3.6/site-packages/_torch_sox.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZN2at19UndefinedTensorImpl10_singletonE
This could be a silly question, but did you install sox-devel
using yum or sox package in anaconda env?
Please try to reinstall after manually deletion of _torch_sox
. If it is not effective, then you can consider the sox installation from the source.
Actually I didn't use the anaconda env, but I guess the sox linked in your system looks like the system's package rather than the anaconda package, which could be the issue of consistency. In my experience, torch 1.0
has some ABI related issues.
Anaconda looks not fully working with pytorch. pyenv works perfectly.
Hello there, I would like to reopen the issue, as I had the same error when trying to use torchaudio
:
My OS is CentOS 7, I am using a Conda environment defined by the following .yml
file:
`name: audinet_env channels:
The installed versions of for the packages of interest are then :
torch = 1.4.0
torchaudio = 0.4.0
When using the torchaudio in my main function, I get the error Undefined symbol: ...
when trying to import _torch_sox
for the __init__.py
script of torchaudio
.
I had the same problem with a Ubuntu 18.04, which I solved by downgrading torchaudio
to 0.3.1
, but the same manoeuver does not work here.
I tried :
torchaudio
pytorch
torchaudio
from source, but I get the building issue for sox.h
listed [HERE], which I can not solve since I am not sudo on this sessionpip
and conda
)I haven't yet tried (because it is a real drag to get out of conda and switch everything to pipenv
):
pipenv
instead of conda virtual environmentsNo success so far, would appreciate a little help
Hi Jinserk,
I encountered the importing model error and tried to find what root cause is with some logs. But it has off the top of my head. Any suggestions?