Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy1.24.3报错 #3235

Open
gxmlfx opened this issue May 10, 2023 · 15 comments
Open

numpy1.24.3报错 #3235

gxmlfx opened this issue May 10, 2023 · 15 comments

Comments

@gxmlfx
Copy link

gxmlfx commented May 10, 2023

General Question

刚装好后,运行了:
paddlespeech asr --lang zh --input zh.wav
log如下:
Traceback (most recent call last):
File "/home/user1/miniconda3/envs/paddle/bin/paddlespeech", line 8, in
sys.exit(_execute())
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/paddlespeech/cli/entry.py", line 40, in _execute
exec("from {} import {}".format(module, cls))
File "", line 1, in
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/paddlespeech/cli/asr/init.py", line 14, in
from .infer import ASRExecutor
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/paddlespeech/cli/asr/infer.py", line 24, in
import librosa
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/librosa/init.py", line 211, in
from . import core
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/librosa/core/init.py", line 9, in
from .constantq import * # pylint: disable=wildcard-import
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/librosa/core/constantq.py", line 1059, in
dtype=np.complex,
File "/home/user1/miniconda3/envs/paddle/lib/python3.9/site-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'complex'.
np.complex was a deprecated alias for the builtin complex. To avoid this error in existing code, use complex by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128 here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

@mgsky1
Copy link

mgsky1 commented May 10, 2023

+1,有同样的问题

@hhuyzp
Copy link

hhuyzp commented May 10, 2023

我也遇到了一样的问题,一个个的改底层,找到报错的地方,把np.float还有np.complex去掉np.就好了

@mgsky1
Copy link

mgsky1 commented May 10, 2023

原来在setup.py的Librosa库是0.8.1,太老了,然后我们的numpy比较新,就有这个问题。
直接把Librosa删掉,安装0.10.0就行

@hhuyzp
Copy link

hhuyzp commented May 10, 2023 via email

@hhuyzp
Copy link

hhuyzp commented May 10, 2023 via email

@mgsky1
Copy link

mgsky1 commented May 10, 2023

还有一种方式,librosa不变,numpy降级为1.23.5

The deprecation for the aliases np.object, np.bool, np.float, np.complex, np.str, and np.int is expired (introduces NumPy 1.20). Some of these will now give a FutureWarning in addition to raising an error since they will be mapped to the NumPy scalars in the future.

https://numpy.org/devdocs/release/1.24.0-notes.html

refer:coqui-ai/TTS#2442

@hhuyzp
Copy link

hhuyzp commented May 10, 2023 via email

@gxmlfx
Copy link
Author

gxmlfx commented May 10, 2023

官方的docker镜像也会提示numpy complex的问题。
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
/usr/local/lib/python3.7/dist-packages/librosa/core/constantq.py:1059: DeprecationWarning: np.complex is a deprecated alias for the builtin complex. To silence this warning, use complex by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128 here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
但是这里可以继续,这似乎是一个仍可用的numpy版本

运行paddlespeech_server start会报 raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
log如下:
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
/usr/local/lib/python3.7/dist-packages/librosa/core/constantq.py:1059: DeprecationWarning: np.complex is a deprecated alias for the builtin complex. To silence this warning, use complex by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.complex128 here.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
dtype=np.complex,
Traceback (most recent call last):
File "/usr/local/bin/paddlespeech_server", line 5, in
from paddlespeech.server.entry import server_execute
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/server/init.py", line 16, in
from .base_commands import ClientBaseCommand
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/server/base_commands.py", line 18, in
from .util import cli_client_register
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/server/util.py", line 32, in
from . import download
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/server/download.py", line 30, in
from paddlespeech.cli.log import logger
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/cli/init.py", line 23, in
from .tts import TTSExecutor
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/cli/tts/init.py", line 14, in
from .infer import TTSExecutor
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/cli/tts/infer.py", line 36, in
from paddlespeech.t2s.frontend import English
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/t2s/init.py", line 18, in
from . import frontend
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/t2s/frontend/init.py", line 16, in
from .phonectic import *
File "/usr/local/lib/python3.7/dist-packages/paddlespeech/t2s/frontend/phonectic.py", line 20, in
from g2p_en import G2p
File "/usr/local/lib/python3.7/dist-packages/g2p_en/init.py", line 1, in
from .g2p import G2p
File "/usr/local/lib/python3.7/dist-packages/g2p_en/g2p.py", line 22, in
nltk.data.find('taggers/averaged_perceptron_tagger.zip')
File "/usr/local/lib/python3.7/dist-packages/nltk/data.py", line 542, in find
return ZipFilePathPointer(p, zipentry)
File "/usr/local/lib/python3.7/dist-packages/nltk/compat.py", line 41, in _decorator
return init_func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/nltk/data.py", line 394, in init
zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
File "/usr/local/lib/python3.7/dist-packages/nltk/compat.py", line 41, in _decorator
return init_func(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/nltk/data.py", line 935, in init
zipfile.ZipFile.init(self, filename)
File "/usr/lib/python3.7/zipfile.py", line 1258, in init
self._RealGetContents()
File "/usr/lib/python3.7/zipfile.py", line 1325, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

@mgsky1
Copy link

mgsky1 commented May 10, 2023

那个只是warning,并不是报错。
那个zip的错误,可以看看这个issue:#1925

@gxmlfx
Copy link
Author

gxmlfx commented May 10, 2023

感谢,我试一下

@mgsky1
Copy link

mgsky1 commented May 10, 2023

我最后把这个问题移到【安装报错留言区】了,感觉这样好一些,本质上不是代码问题,只是环境上的问题

@xtdhwl
Copy link

xtdhwl commented Oct 21, 2023

conda install -c conda-forge librosa

https://librosa.org/doc/latest/install.html
升级librosa

@androidfans
Copy link

原来在setup.py的Librosa库是0.8.1,太老了,然后我们的numpy比较新,就有这个问题。 直接把Librosa删掉,安装0.10.0就行

请问在官方的这个lab页面里面要怎么做这个操作啊 https://aistudio.baidu.com/bd-gpu-01/user/3279555/6931268/lab/tree/main.ipynb

@alittlenico
Copy link

还有一种方式,librosa不变,numpy降级为1.23.5

The deprecation for the aliases np.object, np.bool, np.float, np.complex, np.str, and np.int is expired (introduces NumPy 1.20). Some of these will now give a FutureWarning in addition to raising an error since they will be mapped to the NumPy scalars in the future.

https://numpy.org/devdocs/release/1.24.0-notes.html

refer:coqui-ai/TTS#2442

谢谢 也解决了我的问题

@ilovejs
Copy link

ilovejs commented Jan 5, 2024

pip install -U librosa
pip freeze | grep librosa
# 1.10.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants