SadTalker icon indicating copy to clipboard operation
SadTalker copied to clipboard

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

Open pabst2009 opened this issue 1 year ago • 3 comments

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

pabst2009 avatar Apr 11 '24 11:04 pabst2009

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

HY0011 avatar Apr 11 '24 14:04 HY0011

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

AppStolz avatar Apr 14 '24 02:04 AppStolz

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

Timo9Madrid7 avatar Apr 14 '24 09:04 Timo9Madrid7