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

Can't install piper-phonemize in Python #41

Open
Germling opened this issue Sep 12, 2024 · 12 comments
Open

Can't install piper-phonemize in Python #41

Germling opened this issue Sep 12, 2024 · 12 comments

Comments

@Germling
Copy link

I tried pip install piper-phonemize or cloning the Git directory and installing it manually. Now I don't have it and can't use piper-tts...

@Germling
Copy link
Author

Here's the error message:
(piper-env) C:\Users\XXX>pip install piper-tts
Collecting piper-tts
Using cached piper_tts-1.2.0-py3-none-any.whl.metadata (776 bytes)
INFO: pip is looking at multiple versions of piper-tts to determine which version is compatible with other requirements. This could take a while.
Downloading piper_tts-1.1.0-py3-none-any.whl.metadata (776 bytes)
ERROR: Cannot install piper-tts==1.1.0 and piper-tts==1.2.0 because these package versions have conflicting dependencies.

The conflict is caused by:
piper-tts 1.2.0 depends on piper-phonemize~=1.1.0
piper-tts 1.1.0 depends on piper-phonemize~=1.0.0

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip to attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

@mrfrostycakes
Copy link

Having same issue on my end exactly. Can't install piper-tts due to piper-phenomize but can't find a version of piper-phenomize with pip

@krazyjakee
Copy link

krazyjakee commented Sep 19, 2024

No builds for windows either. Looks like somebody deployed a borked build

@hadware
Copy link

hadware commented Sep 23, 2024

Same here with leanspeech

@JacsonAnderson
Copy link

I encountered a similar issue, and here's how I managed to fix it on my Windows 10 system:
I removed the piper-phonemize line from the requirements.txt file located at: ~\piper\src\python\requirements.txt

Before:
cython>=0.29.0,<1
piper-phonemize~=1.1.0
librosa>=0.9.2,<1
numpy>=1.19.0
onnxruntime>=1.11.0
pytorch-lightning~=1.7.0
torch>=1.11.0,<2

My modified version:
cython>=0.29.0,<1
librosa>=0.9.2,<1
numpy>=1.24.4
onnxruntime>=1.11.0
pytorch-lightning~=1.7.0
torch>=1.11.0

After installing the updated requirements, I installed piper-phonemize-cross individually:
pip install piper-phonemize-cross

You can find it here:
https://pypi.org/project/piper-phonemize-cross/

This worked perfectly for me.

Hope this helps!

@mrfrostycakes
Copy link

mrfrostycakes commented Oct 23, 2024 via email

@mrfrostycakes
Copy link

mrfrostycakes commented Oct 23, 2024 via email

@jgilmore
Copy link

From what I've figured out, this error happens because there's no version of piper-phenomize for python3.12 available on pypi.

To fix it on ubuntu 24.04, I installed python3.11 according to the instructions here and then made a 3.11 venv via instructions here and installed piper_tts, and it just worked™

Here's a copy of the incantations I used as a quick reference and defense against linkrot:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11 python3.11-venv
python3.11 -m venv venv-311
source venv-311/bin/activate
python3 -V
pip install piper_tts

Success!

Note that the "sudo" commands install python3.11 in your base system. It doesn't matter if your previous venv is activated or not, nor which directory you're in. The non-sudo commands create a new virtual environment named "venv-311", activate it, double-check that "python3" invokes the 3.11 version, and then installs piper-tts in the new virtual environment.

Note that installing python3.11 has zero affect on anything else in the base system unless it's explicitly invoked as "pthon3.11" like I did here.

I'm posting this comment here AND on the related issue under piper-tss, just so the next poor benighted soul who googles it actually finds it.

@divotlt
Copy link

divotlt commented Dec 28, 2024

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11 python3.11-venv
python3.11 -m venv venv-311
source venv-311/bin/activate
python3 -V
pip install piper_tts

If you want to do this in a windows machine, type "wsl" on your windows terminal.

@ryandikdan
Copy link

ryandikdan commented Jan 7, 2025

I'm having the same issue that when I'm trying to install piper from their github via python -m pip install -e . in their source folder it says there are no versions available. I've tried running it on wsl and on windows as well on a server and with python 3.8, 3.10, and 3.11. I'm always in a new venv or conda env. It always gives me the same error of

ERROR: Could not find a version that satisfies the requirement piper-phonemize~=1.1.0 (from piper-train) (from versions: none)
ERROR: No matching distribution found for piper-phonemize~=1.1.0

Perhaps PyPi's wheels aren't setup right? I see 1.1.0 on the PyPi website though.

Also when I try to install it from the github repo I get a missing header error when compiling with g++:
src/phonemize.cpp:5:33: fatal error: espeak-ng/speak_lib.h: No such file or directory

@hapasa
Copy link

hapasa commented Feb 9, 2025

To build the python wheel of the most recent version, 1.2.0, I had to modify the setup.py to be the following:

import platform
from pathlib import Path

# Available at setup time due to pyproject.toml
from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup

_DIR = Path(__file__).parent

__version__ = "1.2.0"

ext_modules = [
    Pybind11Extension(
        "piper_phonemize_cpp",
        [
            "src/python.cpp",
            "src/phonemize.cpp",
            "src/phoneme_ids.cpp",
            "src/tashkeel.cpp",
        ],
        define_macros=[("VERSION_INFO", __version__)],
        include_dirs=[str(_DIR / "install" / "include")],  # Add this path
        library_dirs=[str(_DIR / "install" / "lib")],  # Add this path
        libraries=["espeak-ng", "onnxruntime"],
    ),
]

setup(
    name="piper_phonemize",
    version=__version__,
    author="Michael Hansen",
    author_email="[email protected]",
    url="https://github.com/rhasspy/piper-phonemize",
    description="Phonemization libary used by Piper text to speech system",
    long_description="",
    packages=["piper_phonemize"],
    package_data={
        "piper_phonemize": [
            str(p) for p in (_DIR / "piper_phonemize" / "espeak-ng-data").rglob("*")
        ]
        + [str(_DIR / "libtashkeel_model.ort")]
    },
    include_package_data=True,
    ext_modules=ext_modules,
    cmdclass={"build_ext": build_ext},
    zip_safe=False,
    python_requires=">=3.7",
)

The the actual build:

python3 -m venv venv
source venv/bin/activate
pip install setuptools pybind11 wheel
python setup.py bdist_wheel

However, the actual piper-tts uses previous version 1.1.0.

@hapasa
Copy link

hapasa commented Feb 9, 2025

To make the Windows build work in non WSL windows seems to be trickier.

My current notes are:

Setup compiler env, paths:

C:/VS/2022/Community/VC/Auxiliary/Build/vcvarsx86_amd64.bat

Add BOM mark to src/phoneme_ids.hpp
So save it with UTF8 with BOM, otherwise Visual C++ gets confused, not understanding that the file is utf-8

There is no make, so run cmake manually:

cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install
cmake --build build --config Release
REM cd build && ctest --config Release   # this failed?
cmake --install build

The wheel builds for windows using the modified setup.py from above.
However, it is not working, looks like some dll dependency issue or missing dll.

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

9 participants