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

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

Open
pabst2009 opened this issue Apr 11, 2024 · 3 comments
Open

Comments

@pabst2009
Copy link

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
Copy link

HY0011 commented Apr 11, 2024

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
Copy link

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%
#822 (comment)

@Timo9Madrid7
Copy link

Timo9Madrid7 commented Apr 14, 2024

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

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

No branches or pull requests

4 participants