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

Failed building wheel for thinc #25

Closed
SBGxJAMES opened this issue Jan 30, 2025 · 9 comments
Closed

Failed building wheel for thinc #25

SBGxJAMES opened this issue Jan 30, 2025 · 9 comments

Comments

@SBGxJAMES
Copy link

Hey guys, I tried pip installing Kokoro. Everything seems to start off going well then towards the end of the install I get the error
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for thinc
Failed to build thinc
ERROR: Failed to build installable wheels for some pyproject.toml based projects (thinc)
[end of output]
I'll be honest, I'm not a programmer and I dont know what this means or how to fix it so I'm reaching out to see if anyone can guide me on a solution. Thank you in advance for anyone willing to help. please keep in mind I'm not a programmer so if you are willing to help if you could explain it to me like I'm a toddler that would help lol.

@SBGxJAMES
Copy link
Author

If I try "pip install kokoro --pre" I get a similar error except instead of thinc the error is for blis instead.
ERROR: Failed building wheel for blis
Failed to build blis
ERROR: Failed to build installable wheels for some pyproject.toml based projects (blis)
[end of output]
I tried to "pip install --upgrade setuptools wheel" followed by "pip cache purge" this did not help either

@itsfarseen
Copy link
Contributor

I had the same issue with Python 3.13.
So I tried with Python 3.9 and it worked.

If you're using conda, use this environment.yml file:

name: kokoro
channels:
  - defaults
dependencies:
  - python==3.9
  - pip:
      - kokoro>=0.3.1
      - soundfile

@SBGxJAMES
Copy link
Author

Thank you that worked. Like I said I'm not a programmer so can you explain to me once I conda activate the env how do I use kokoro. What I mean is with other conda env I have I get a local host address that I can use the app at. So I guess what Im asking is what steps do I take after I activate the conda env in order to use kokoro? Thanks again for helping get this far

@itsfarseen
Copy link
Contributor

itsfarseen commented Feb 1, 2025

once I conda activate the env how do I use kokoro

Create a conda env with the above config: conda env create --file=<env-yaml-file> -n <env-name>
Activate the new env: conda activate <env-name>
Copy the example from the README into run.py, and run it using python run.py.

Here's the example I use to generate a sample of all american voices:

from kokoro import KPipeline
import soundfile as sf
from pathlib import Path
import torch


def generate_voice_swatches():
    voices = """
    af_heart 	
    af_alloy 	
    af_aoede 	
    af_bella 	
    af_jessica
    af_kore 	
    af_nicole 
    af_nova 	
    af_river 	
    af_sarah 	
    af_sky 
    am_adam 	
    am_echo 	
    am_eric 	
    am_fenrir 
    am_liam 	
    am_michael
    am_onyx 	
    am_puck 	
    am_santa 	
    """
    voices = voices.split()
    text = "Weakness on short utterances, especially less than 10-20 tokens. Root cause could be lack of short-utterance training data and/or model architecture. One possible inference mitigation is to bundle shorter utterances together."
    for voice in voices:
        generate(text, voice, f"{voice}.wav")


# Generate the audio for `text` using `voice` and save it to `outfile` as WAV
def generate(text, voice, outfile):
    generator = pipeline(
        text,
        voice=voice,
        speed=1,  # type: ignore (https://github.com/python/mypy/issues/3186)
        split_pattern=r"\n+",
    )

    data = []
    for gs, ps, audio in generator:
        data.append(audio)

    # concatenate each "chunk" of audio samples
    concated = torch.concatenate(data)

    sf.write(outfile, concated, 24000)


generate_voice_swatches()

@hexgrad
Copy link
Owner

hexgrad commented Feb 2, 2025

Above comments might have solutions. As for potential root cause, I suspect it might be a spacy issue. Searching "Failed building wheel for thinc" returns spacy in the top results, which is an English dependency:
https://stackoverflow.com/questions/43370851/failed-building-wheel-for-spacy
https://stackoverflow.com/questions/78752258/cant-install-spacy-and-thinc-on-python

@itsfarseen
Copy link
Contributor

@hexgrad, those questions seem to be too old (2018ish).

@SBGxJAMES could you confirm if you're on a rolling release distro like Arch or Fedora?
Could you also confirm your python version?

Here's the PR that adds Python 3.13 supported to thincc. It's not merged yet.
explosion/thinc#951

I think the version constraint in my conda env file was too aggressive. If anyone have the time to test it with Python 3.12 and confirm, we can relax the constraint in the env file added in the README.

This sort of things happen a lot, so I always try to test it with the current python version minus 1 and the python version that ships with debian.

@SBGxJAMES
Copy link
Author

Hey guys, sorry I've been out of town all weekend and thank you to everyone helping me. @itsfarseen I'm on windows 11 not linux. I did succesfully install using the yml env you provided but like I said I'm not a programmer so I tend to get lost in the weeds when I try to do a lot of this stuff. please bare with me lol. I really do appreciate all the help. After I execute the conda activate kokoro command in my cmd prompt. Im not sure what to do next. Is there a ui or do I need to work from an ide? I understand enough about code to work from an ide but just barely lol. What I mean is with other AI that I have been learning recently there is a local host with a ui like open-webui for LLMs or ComfyUI for diffusion models. So if there isnt a ui I see you said copy your example into run.py and run it. I follow you sort of except I'm not sure where the run.py file is located nor do I know what you mean by copy it into the run.py file. I realize I dont know what I'm talking about and it may be tiresome trying to hold my hand so no hard feelings if I'm asking for too much guidance but I do appreciate the help. IF that example generates a sample of all american voices, do I then just limit the list to the voice I want and replace the example text with the text I wish to generate in order to generate my desired tts file? Also If I'm asking too much for an issue post the mod can move this to discussion if you guys are willing to hold my hand while I learn thats cool too. Again thanks for everyones help.

@itsfarseen
Copy link
Contributor

@SBGxJAMES, since this is no longer about the original issue (failed to build thinc), let's move this discussion elsewhere. I can't find a "discussion" tab for this repo, so we can discuss this over email.
You can find my email on my github profile.

If the above conda snippet solves the original issue for you, please close this issue.

@SBGxJAMES
Copy link
Author

The above conda snippet does solve the issue thanks.

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

3 participants