question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"tts" command cannot be initialized (ImportError: numpy.core.multiarray failed to import)

See original GitHub issue

Describe the bug

Hello,

I installed numpy version 1.21.6 (required by this package) but I’m getting numpy errors when entering “tts”. All my other packages are up to date.

To Reproduce

$ tts

Expected behavior

Initialize TTS environment

Logs

/usr/lib/python3.10/site-packages/torch/_masked/__init__.py:223: UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of numpy is 0xe (Triggered internally at  /build/python-pytorch/src/pytorch-1.11.0-cuda/torch/csrc/utils/tensor_numpy.cpp:68.)
  example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]])
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xe
Traceback (most recent call last):
  File "/usr/bin/tts", line 33, in <module>
    sys.exit(load_entry_point('TTS', 'console_scripts', 'tts')())
  File "/usr/bin/tts", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/privateserver/TTS/TTS/bin/synthesize.py", line 12, in <module>
    from TTS.utils.synthesizer import Synthesizer
  File "/home/privateserver/TTS/TTS/utils/synthesizer.py", line 14, in <module>
    from TTS.utils.audio import AudioProcessor
  File "/home/privateserver/TTS/TTS/utils/audio.py", line 3, in <module>
    import librosa
  File "/home/privateserver/.local/lib/python3.10/site-packages/librosa/__init__.py", line 211, in <module>
    from . import core
  File "/home/privateserver/.local/lib/python3.10/site-packages/librosa/core/__init__.py", line 5, in <module>
    from .convert import *  # pylint: disable=wildcard-import
  File "/home/privateserver/.local/lib/python3.10/site-packages/librosa/core/convert.py", line 7, in <module>
    from . import notation
  File "/home/privateserver/.local/lib/python3.10/site-packages/librosa/core/notation.py", line 8, in <module>
    from ..util.exceptions import ParameterError
  File "/home/privateserver/.local/lib/python3.10/site-packages/librosa/util/__init__.py", line 83, in <module>
    from .utils import *  # pylint: disable=wildcard-import
  File "/home/privateserver/.local/lib/python3.10/site-packages/librosa/util/utils.py", line 6, in <module>
    import scipy.ndimage
  File "/usr/lib/python3.10/site-packages/scipy/ndimage/__init__.py", line 151, in <module>
    from ._filters import *  # noqa: F401 F403
  File "/usr/lib/python3.10/site-packages/scipy/ndimage/_filters.py", line 37, in <module>
    from . import _nd_image
ImportError: numpy.core.multiarray failed to import

Environment

/usr/lib/python3.10/site-packages/torch/_masked/__init__.py:223: UserWarning: Failed to initialize NumPy: module compiled against API version 0xf but this version of numpy is 0xe (Triggered internally at  /build/python-pytorch/src/pytorch-1.11.0-cuda/torch/csrc/utils/tensor_numpy.cpp:68.)
  example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]])
{
    "CUDA": {
        "GPU": [
            "NVIDIA GeForce RTX 3060"
        ],
        "available": true,
        "version": "11.6"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "1.11.0",
        "TTS": "0.6.2",
        "numpy": "1.21.6"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            "ELF"
        ],
        "processor": "",
        "python": "3.10.4",
        "version": "#1 SMP PREEMPT_DYNAMIC Mon, 30 May 2022 17:53:11 +0000"
    }
}

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
p0p4kcommented, Jun 21, 2022

Hello, these kind of errors will keep repeating since open-source packages are dependent on each other. It is not a big bug, rather you need to keep track of what is installed in your existing environment. Earlier, in your system, numpy was installed but version was too high, now numba is asking you to fallback to specific numpy version (less than v1.22, but yours is v1…22.4) and so on…

  • So, if you learn to read and understand the error messages, you can clearly see that first, uninstalling the current numpy (v1.22.4) in your environment and then second, installing something less than v1.22 (for numba to work correctly) will fix the issue. 😃

pkg_resources.ContextualVersionConflict: (numpy 1.22.4 (/usr/lib/python3.10/site-packages), Requirement.parse('numpy<1.22,>=1.18'), {'numba'})

Hopefully, this fixes your bugs. If not, please comment again. Good luck! 👍

1reaction
p0p4kcommented, Jun 8, 2022

Now you have 2 options,

  1. edit requirements.txt file and remove the “==xx.xx” version in front of numpy and then retry tts. OR
  2. uninstall numpy completely first (using pip/conda), retry installing original requirements.txt OR My conda environment for 🐸 TTS has numpy 1.21.6, so i am wondering if is it really numpy the issue or any other dependency… Anyway, try and report back.
Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: numpy.core.multiarray failed to import #559 - GitHub
Reboot your mac and hold Cmd+R at the startup chime. · Chose Terminal>Utilities from the top menu bar. · Type: csrutil disable; reboot...
Read more >
ImportError: numpy.core.multiarray failed to import
I found the bad numpy version by using the following command in my Mac terminal:
Read more >
ImportError numpy core multiarray failed to import - Edureka
I am trying to import the cv2 module in Jupyter Notebook. But It is showing me the below error. import cv2 ImportError: numpy.core.multiarray...
Read more >
ImportError: numpy.core.multiarray failed to import [cv2 ...
This error occurs because of an improper/incompatible version of NUMPY. As we all know that most of the machine learning and deep learning...
Read more >
[Solved] ImportError: numpy.core.multiarray Failed to Import
ImportError : numpy.core.multiarray failed to import error. Follow these steps to solve the error. Open CLI and run the following command:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found