Skip to content

[Bug] module 'numpy' has no attribute 'dtypes' #4178

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

Open
qyum opened this issue Mar 31, 2025 · 6 comments
Open

[Bug] module 'numpy' has no attribute 'dtypes' #4178

qyum opened this issue Mar 31, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@qyum
Copy link

qyum commented Mar 31, 2025

Describe the bug


**AttributeError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1975 try:
-> 1976 return importlib.import_module("." + module_name, self.name)
1977 except Exception as e:

42 frames
AttributeError: module 'numpy' has no attribute 'dtypes'

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1976 return importlib.import_module("." + module_name, self.name)
1977 except Exception as e:
-> 1978 raise RuntimeError(
1979 f"Failed to import {self.name}.{module_name} because of the following error (look up to see its"
1980 f" traceback):\n{e}"

RuntimeError: Failed to import transformers.models.gpt2.modeling_gpt2 because of the following error (look up to see its traceback):
module 'numpy' has no attribute 'dtypes'**

To Reproduce

print(TTS().list_models())
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)

Expected behavior

No response

Logs

Environment

PYTHON 3.11
numpy==1.24.3

Additional context

No response

@qyum qyum added the bug Something isn't working label Mar 31, 2025
@PimiYvan
Copy link

same issue on my side

@eginhard
Copy link
Contributor

Could you try using our fork (available via pip install coqui-tts) and a more recent Numpy version? This repo is not maintained anymore and Numpy 1.24.3 is quite old now.

@qyum
Copy link
Author

qyum commented Mar 31, 2025

@eginhard ModuleNotFoundError Traceback (most recent call last)
in <cell line: 0>()
1 import torch
----> 2 from TTS.api import TTS
3
4 # Get device
5 device = "cuda" if torch.cuda.is_available() else "cpu"

13 frames
/usr/local/lib/python3.11/dist-packages/numpy/init.py in getattr(attr)
365 raise AssertionError()
366 except AssertionError:
--> 367 msg = ("The current Numpy installation ({!r}) fails to "
368 "pass simple sanity checks. This can be caused for example "
369 "by incorrect BLAS library being linked in, or by mixing "

ModuleNotFoundError: No module named 'numpy.char'

still same.
pip install coqui-tts not working

@qyum
Copy link
Author

qyum commented Mar 31, 2025

@eginhard numpy==1.26.4 not working

@eginhard
Copy link
Contributor

This looks like an issue with your Numpy installation (i.e. just import numpy probably fails already), not Coqui. It works fine for me in a clean virtual environment:

$ uv run --with coqui-tts -p 3.11 python -c "import numpy; print('Numpy', numpy.__version__); import TTS; print('coqui-tts', TTS.__version__)"
Numpy 1.26.4
coqui-tts 0.26.0

@Aadityachauhan463
Copy link

Same issue on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants