r9y9 / ttslearn

ttslearn: Library for Pythonで学ぶ音声合成 (Text-to-speech with Python)

Home Page:https://r9y9.github.io/ttslearn/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

from ttslearn.dnntts import DNNTTS にてtorchのImportError

ftnext opened this issue · comments

macOS(GPUはない環境です)
Python 3.9.4

再現手順

$ pip install ttslearn
$ python
>>> from ttslearn.dnntts import DNNTTS
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/.../venv/lib/python3.9/site-packages/ttslearn/__init__.py", line 3, in <module>
    from . import util
  File "/Users/.../venv/lib/python3.9/site-packages/ttslearn/util.py", line 12, in <module>
    import torch
  File "/Users/.../venv/lib/python3.9/site-packages/torch/__init__.py", line 202, in <module>
    from torch._C import *  # noqa: F403
ImportError: dlopen(/Users/.../venv/lib/python3.9/site-packages/torch/_C.cpython-39-darwin.so, 2): Library not loaded: @loader_path/../.dylibs/libomp.dylib
  Referenced from: /Users/.../venv/lib/python3.9/site-packages/torch/lib/libtorch_cpu.dylib
  Reason: no suitable image found.  Did find:
	/Users/.../venv/lib/python3.9/site-packages/torch/lib/../.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)
	/Users/.../venv/lib/python3.9/site-packages/torch/lib/../.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)

環境情報

$ pip freeze
antlr4-python3-runtime==4.9.3
appdirs==1.4.4
argcomplete==2.0.0
audioread==2.1.9
beautifulsoup4==4.11.1
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.0
cycler==0.11.0
Cython==0.29.30
decorator==5.1.1
fastdtw==0.3.4
filelock==3.7.1
fonttools==4.34.4
gdown==4.5.1
h5py==3.7.0
hydra-core==1.2.0
idna==3.3
joblib==1.1.0
kaldiio==2.17.2
kiwisolver==1.4.4
librosa==0.9.2
llvmlite==0.38.1
matplotlib==3.5.2
nnmnkwii==0.1.1
numba==0.55.2
numpy==1.22.4
omegaconf==2.2.2
packaging==21.3
parallel-wavegan==0.5.5
Pillow==9.2.0
pooch==1.6.0
protobuf==3.20.1
pycparser==2.21
pyopenjtalk==0.2.0
pyparsing==3.0.9
PySocks==1.7.1
pysptk==0.1.21
python-dateutil==2.8.2
pyworld==0.3.0
PyYAML==6.0
requests==2.28.1
resampy==0.3.1
scikit-learn==1.1.1
scipy==1.8.1
six==1.16.0
SoundFile==0.10.3.post1
soupsieve==2.3.2.post1
tensorboardX==2.5.1
threadpoolctl==3.1.0
toml==0.10.2
torch==1.12.0
tqdm==4.64.0
ttslearn==0.2.2
typing_extensions==4.3.0
urllib3==1.26.10
xmltodict==0.13.0
yq==3.0.2

Workaround

$ pip install -U 'torch<1.11'
$ python
>>> from ttslearn.dnntts import DNNTTS

torchのバージョンを固定すれば対応できそうに思います
https://github.com/r9y9/ttslearn/blob/v0.2.2/setup.py#L37

確認が遅くなってしまい申し訳ありません。私の環境では問題なく動きました。エラーメッセージを見るに、環境依存の問題だと思われます。

Python 3.8.12 | packaged by conda-forge | (default, Jan 30 2022, 23:33:09)
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
torch.__version__
>>> torch.__version__
'1.12.0'