OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
11.99k stars 2.24k forks source link

AttributeError: module 'numpy' has no attribute 'complex' in extension.py #862

Open pabst2009 opened 7 months ago

pabst2009 commented 7 months ago

I get the following error by running the webui.sh with Python 3.10.12 and Numpy 1.26.2 on ubuntu22.04:

load Sadtalker Checkpoints from /ihdd/ubuntu/sdweb/extensions/SadTalker/checkpoints
*** Error executing callback ui_tabs_callback for /ihdd/ubuntu/sdweb/extensions/SadTalker/scripts/extension.py
    Traceback (most recent call last):
      File "/ihdd/ubuntu/sdweb/modules/script_callbacks.py", line 180, in ui_tabs_callback
        res += c.callback() or []
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/scripts/extension.py", line 172, in on_ui_tabs
        from app_sadtalker import sadtalker_demo
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/app_sadtalker.py", line 3, in <module>
        from src.gradio_demo import SadTalker
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/gradio_demo.py", line 6, in <module>
        from src.generate_batch import get_data
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/generate_batch.py", line 8, in <module>
        import src.utils.audio as audio
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/utils/audio.py", line 1, in <module>
        import librosa
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/__init__.py", line 211, in <module>
        from . import core
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/core/__init__.py", line 9, in <module>
        from .constantq import *  # pylint: disable=wildcard-import
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/core/constantq.py", line 1058, in <module>
        dtype=np.complex,
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/numpy/__init__.py", line 324, 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
HY0011 commented 7 months ago

File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/core/constantq.py", line 1058, in dtype=np.complex, Change np.complex in this file to complex

AppStolz commented 7 months ago

I get the following error by running the webui.sh with Python 3.10.12 and Numpy 1.26.2 on ubuntu22.04:

load Sadtalker Checkpoints from /ihdd/ubuntu/sdweb/extensions/SadTalker/checkpoints
*** Error executing callback ui_tabs_callback for /ihdd/ubuntu/sdweb/extensions/SadTalker/scripts/extension.py
    Traceback (most recent call last):
      File "/ihdd/ubuntu/sdweb/modules/script_callbacks.py", line 180, in ui_tabs_callback
        res += c.callback() or []
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/scripts/extension.py", line 172, in on_ui_tabs
        from app_sadtalker import sadtalker_demo
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/app_sadtalker.py", line 3, in <module>
        from src.gradio_demo import SadTalker
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/gradio_demo.py", line 6, in <module>
        from src.generate_batch import get_data
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/generate_batch.py", line 8, in <module>
        import src.utils.audio as audio
      File "/ihdd/ubuntu/sdweb/extensions/SadTalker/src/utils/audio.py", line 1, in <module>
        import librosa
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/__init__.py", line 211, in <module>
        from . import core
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/core/__init__.py", line 9, in <module>
        from .constantq import *  # pylint: disable=wildcard-import
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/librosa/core/constantq.py", line 1058, in <module>
        dtype=np.complex,
      File "/ihdd/ubuntu/sdweb/env/lib/python3.10/site-packages/numpy/__init__.py", line 324, 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

Take a look here at a solution that works 100% https://github.com/OpenTalker/SadTalker/issues/822#issuecomment-2053857698

Timo9Madrid7 commented 7 months ago

I used pip install --upgrade librosa to update the librosa version from 0.8.0 to 0.10.1 and the issue was fixed

or python -m pip install -U librosa if pip is not available