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

Macbook Pro M3 Max Install Issue: Cythonizing spacy/kb.pyx #13482

Open
brianragle opened this issue May 8, 2024 · 3 comments
Open

Macbook Pro M3 Max Install Issue: Cythonizing spacy/kb.pyx #13482

brianragle opened this issue May 8, 2024 · 3 comments
Labels
install Installation issues

Comments

@brianragle
Copy link

brianragle commented May 8, 2024

I am posting this issue here after encountering it while trying to install a different program using it. The link to that other issue is below and the recommendation was that I file a report here. I will also reproduce the response from the other dev below my paste of my issue:

erew123/alltalk_tts#205

This is a 4 day old MBP with a fresh install of Python, with all other relevant updates applied.

Describe the bug
text-generation-webui installed without issue. Followed steps on Alltalk page up to this one:

pip install -r system/requirements/requirements_textgen.txt

Consistently errors out (see below)

To Reproduce
Run "pip install -r system/requirements/requirements_textgen.txt"

Text/logs

[ 2/41] Cythonizing spacy/kb.pyx
Traceback (most recent call last):
File "/Users/brianragle/Documents/TextGen/text-generation-webui/installer_files/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
main()
File "/Users/brianragle/Documents/TextGen/text-generation-webui/installer_files/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brianragle/Documents/TextGen/text-generation-webui/installer_files/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/vs/r77xwd5136q3gy3m_nncg_1h0000gn/T/pip-build-env-nop3b6d2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/vs/r77xwd5136q3gy3m_nncg_1h0000gn/T/pip-build-env-nop3b6d2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "/private/var/folders/vs/r77xwd5136q3gy3m_nncg_1h0000gn/T/pip-build-env-nop3b6d2/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "", line 224, in
File "", line 211, in setup_package
File "/private/var/folders/vs/r77xwd5136q3gy3m_nncg_1h0000gn/T/pip-build-env-nop3b6d2/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
cythonize_one(*args)
File "/private/var/folders/vs/r77xwd5136q3gy3m_nncg_1h0000gn/T/pip-build-env-nop3b6d2/overlay/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: spacy/kb.pyx
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.

Desktop (please complete the following information):
AllTalk was updated:NA
Custom Python environment: No
Text-generation-webUI was updated: 2024May06

AllTalk dev response:

Investigation/Research

This is a difficult one for me to help/advise upon as I don't have a mac, let alone a ARM based one. However, I have done what research I can on this and found that:

Cython don't make pre-build AMD wheels for mac. So Im not sure what version of Cython will have installed on your mac. cython/cython#5904 (re pre built wheels). As I understand reading that chain, Cython should compile from source (maybe) when its requested as someone suggests ARM macs are fast enough to do this (but I don't know the truth of that and have no way to test).

Because there is no wheel file for ARM based macs, you cant put it in the requirements file for PIP to compare what is the correct version to install for your requirements file. Pip is designed to look through the requirements file and figure out what versions of everything you request it installs will happily work together, its an installed with a compatibility checker.

Cython and Spacy are pre-requisites of the Coqui TTS engine:
image.png (view on web)

as far as I am aware people have installed both the Coqui TTS engine on x86 based macs and I believe ARM based macs. e.g coqui-ai/TTS#2177

The error you have seems to be specifically related to when the Coqui TTS engine is being called to be installed, its calling on Cython to compile Spacy (as per the prerequisites of Coqui TTS).

I've been through the Pull Request, Code updates, Releases and Issues for Spacy and see no listing of problems with Mac installation or updates for Mac installation https://github.com/explosion/spaCy

As such, I can only conclude that this is either the version of Cython on your mac maybe being an older version (though I have no idea how it installed into your Python environment, being that it needs compiling) OR something in a recent release of Cython that causes an incompatibility with compiling Spacy. Either way, the issue seems to be between these two packages. (Neither of which I have control over of course and I cannot give you a wheel file to suggest installing for Cython, because no wheel file exists).

Possible things to try

My best thought at this point in time would be to open your terminal on your mac and go into the text-gen-webui folder and start the Python environment with cmd_macos.sh

From there you can type pip show cython to confirm what version of Cython is installed. I cant say exactly what versions do or don't work. What I can say is that I started AllTalk when Cython 3.0.6 was the current build and Cython 3.0.10 is the current build as of March 2024. So I would assume that versions in that region would work, but that is an assumption.

If possible, I would try to get your text-gen-webui Python environment on Cython 3.0.10

If its on Cython 3.0.10 (or at least 3.0.6) I would manually try installing Spacy, which again is, text-gen-webui folder and start the Python environment with cmd_macos.sh then pip install spacy and see if that installs/compiles.

If Spacy installs/compiles, then re-try the AllTalk setup by installing the requirements. If it doesn't, then its probably something for Spacy to look into, though they would need to know what version of Cython you have installed on your machine. They would have to figure out why Spacy isnt compiling on the version of Cython you have installed and guide you as to how to resolve it.

If I had a ARM based mac, I would happily go to them, but I would be unable to test anything or give them further information based on anything they ask/suggest.

Updated requirements for Text-gen-webui

The only other thing I have done in all of this is to install a fresh install of Text-gen-webui on my machine (in Windows I admit) however, I did notice that when installing the TTS engine PIP was hunting around trying to find a copy of Spacy to install. I think it went through 10+ attempts at finding a version and I gave up at that point as it was taking maybe 5 minutes per attempt.

What I've done is to add Spacy to the requirements file and nailed it to versions greater than 3.7.2 (which is over 6 months old) which will at least stop it hunting around for multiple versions. This commit is here erew123/alltalk_tts@6808439

I would suggest you git pull AllTalk down before you attempt to reinstall its requirements.

Ill close the ticket for now, but you are welcome to come back to me if you wish.

Thanks

@svlandeg svlandeg added the install Installation issues label May 15, 2024
@svlandeg
Copy link
Member

Hi! Sorry to hear you're running into issues. I wonder whether this might be related to #13449. We'll investigate further!

@svlandeg
Copy link
Member

svlandeg commented Jun 5, 2024

Hi! Could you check whether the newly released v3.7.5 fixes this issue?

@italogbr-blip
Copy link

Hello, I can try to solve your problem by contacting +55 22 997859221

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

No branches or pull requests

3 participants