在启智平台AI调试环境下,安装mindnlp后,import mindnlp报错。
安装mindnlp命令:
#安装mindnlp的daily包,待正式发布后可改为直接安装mindnlp包
!pip install https://mindspore-courses.obs.cn-north-4.myhuaweicloud.com/mindnlp/mindnlp-0.4.0-py3-none-any.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
# !pip install mindnlp==0.4.0
!pip install jieba -i https://pypi.tuna.tsinghua.edu.cn/simple
!pip install tiktoken -i https://pypi.tuna.tsinghua.edu.cn/simple
%env HF_ENDPOINT=https://hf-mirror.com
import mindnlp报错信息:
[WARNING] ME(106:281472992808976,MainProcess):2024-10-10-01:21:04.337.056 [mindspore/hal/device.py:155] Backend Ascend is not created yet.
[WARNING] ME(106,ffff89c01010,python):2024-10-10-01:21:04.336.789 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:466] GetDeviceContext] Device context of device Ascend is not created yet.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
File /home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/soundfile.py:161
159 raise OSError('no packaged library for this platform')
--> 161 import _soundfile_data # ImportError if this doesn't exist
162 _path = _os.path.dirname(_soundfile_data.__file__) # TypeError if __file__ is None
ModuleNotFoundError: No module named '_soundfile_data'
During handling of the above exception, another exception occurred:
OSError: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory
解决问题:
看到PaddleSpeech有个issue:https://github.com/PaddlePaddle/PaddleSpeech/issues/3044
说参考这个issue:https://github.com/PaddlePaddle/PaddleSpeech/issues/440
提示:
libsndfile.so 安装目录是在“/usr/local/lib”下面,检查一下你的“LD_LIBRARY_PATH”是否包含这个目录,如果没有就export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH,再尝试运行一下。
问题是这个系统里根本就没有libsndfile这个库,
ls /usr/local/lib发现该目录下没东西。而且启智没法用pkg安装包。
pkg search wget
sh: pkg: command not found
原来启智用的系统是EulerOS ,包管理软件是yum ,于是用yum来安装libsndfile包:
yum install libsndfile
这样报错问题解决。