Install fails on Mac because Mac doesn't support xformers
Including this comment from closed issue #82:
@krummrey , I am trying to get this working on the Mac via pip install -r requirements.txt I tried to match your March 14 version just so we are on the same baseline I am using python 3.12
Can you help. Not sure why it says torch module not found when it clearly was installed
(venvtaggui) anand@Anands-MacBook-Pro taggui % pip install torch
Collecting torch
Using cached torch-2.4.0-cp312-none-macosx_11_0_arm64.whl.metadata (26 kB)
Collecting filelock (from torch)
Using cached filelock-3.15.4-py3-none-any.whl.metadata (2.9 kB)
Collecting typing-extensions>=4.8.0 (from torch)
Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting sympy (from torch)
Using cached sympy-1.13.2-py3-none-any.whl.metadata (12 kB)
Collecting networkx (from torch)
Using cached networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting jinja2 (from torch)
Using cached jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch)
Using cached fsspec-2024.6.1-py3-none-any.whl.metadata (11 kB)
Collecting setuptools (from torch)
Using cached setuptools-72.2.0-py3-none-any.whl.metadata (6.6 kB)
Collecting MarkupSafe>=2.0 (from jinja2->torch)
Using cached MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl.metadata (3.0 kB)
Collecting mpmath<1.4,>=1.1.0 (from sympy->torch)
Using cached mpmath-1.3.0-py3-none-any.whl.metadata (8.6 kB)
Using cached torch-2.4.0-cp312-none-macosx_11_0_arm64.whl (62.1 MB)
Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Using cached filelock-3.15.4-py3-none-any.whl (16 kB)
Using cached fsspec-2024.6.1-py3-none-any.whl (177 kB)
Using cached jinja2-3.1.4-py3-none-any.whl (133 kB)
Using cached networkx-3.3-py3-none-any.whl (1.7 MB)
Using cached setuptools-72.2.0-py3-none-any.whl (2.3 MB)
Using cached sympy-1.13.2-py3-none-any.whl (6.2 MB)
Using cached MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl (18 kB)
Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Installing collected packages: mpmath, typing-extensions, sympy, setuptools, networkx, MarkupSafe, fsspec, filelock, jinja2, torch
Successfully installed MarkupSafe-2.1.5 filelock-3.15.4 fsspec-2024.6.1 jinja2-3.1.4 mpmath-1.3.0 networkx-3.3 setuptools-72.2.0 sympy-1.13.2 torch-2.4.0 typing-extensions-4.12.2
[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
(venvtaggui) anand@Anands-MacBook-Pro taggui % vi requirements.txt
(venvtaggui) anand@Anands-MacBook-Pro taggui % pip install -r requirements.txt
Ignoring torch: markers 'platform_system == "Windows" and python_version == "3.11"' don't match your environment
Ignoring torch: markers 'platform_system == "Windows" and python_version == "3.10"' don't match your environment
Ignoring auto-gptq: markers 'platform_system == "Linux" or platform_system == "Windows"' don't match your environment
Collecting accelerate==0.27.2 (from -r requirements.txt (line 1))
Using cached accelerate-0.27.2-py3-none-any.whl.metadata (18 kB)
Collecting bitsandbytes==0.42.0 (from -r requirements.txt (line 2))
Using cached bitsandbytes-0.42.0-py3-none-any.whl.metadata (9.9 kB)
Collecting ExifRead==3.0.0 (from -r requirements.txt (line 3))
Using cached ExifRead-3.0.0-py3-none-any.whl.metadata (6.4 kB)
Collecting imagesize==1.4.1 (from -r requirements.txt (line 4))
Using cached imagesize-1.4.1-py2.py3-none-any.whl.metadata (1.5 kB)
Collecting Pillow==10.2.0 (from -r requirements.txt (line 5))
Using cached pillow-10.2.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (9.7 kB)
Collecting pyparsing==3.1.2 (from -r requirements.txt (line 6))
Using cached pyparsing-3.1.2-py3-none-any.whl.metadata (5.1 kB)
Collecting PySide6==6.6.2 (from -r requirements.txt (line 7))
Using cached PySide6-6.6.2-cp38-abi3-macosx_11_0_universal2.whl.metadata (5.3 kB)
Collecting transformers==4.38.2 (from -r requirements.txt (line 8))
Using cached transformers-4.38.2-py3-none-any.whl.metadata (130 kB)
Requirement already satisfied: torch==2.4.0 in ./venvtaggui/lib/python3.12/site-packages (from -r requirements.txt (line 11)) (2.4.0)
Collecting einops==0.7.0 (from -r requirements.txt (line 16))
Using cached einops-0.7.0-py3-none-any.whl.metadata (13 kB)
Collecting protobuf==4.25.3 (from -r requirements.txt (line 17))
Using cached protobuf-4.25.3-cp37-abi3-macosx_10_9_universal2.whl.metadata (541 bytes)
Collecting sentencepiece==0.2.0 (from -r requirements.txt (line 18))
Using cached sentencepiece-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (7.7 kB)
Collecting torchvision==0.17.0 (from -r requirements.txt (line 19))
Using cached torchvision-0.17.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (6.6 kB)
Collecting xformers==0.0.24 (from -r requirements.txt (line 20))
Using cached xformers-0.0.24.tar.gz (3.9 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
Traceback (most recent call last):
File "/Users/anand/Projects/taggui/venvtaggui/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/anand/Projects/taggui/venvtaggui/lib/python3.12/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/anand/Projects/taggui/venvtaggui/lib/python3.12/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/hj/wcklqv7d12b3kxx0z08blw180000gn/T/pip-build-env-7_yqfw5c/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/hj/wcklqv7d12b3kxx0z08blw180000gn/T/pip-build-env-7_yqfw5c/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
self.run_setup()
File "/private/var/folders/hj/wcklqv7d12b3kxx0z08blw180000gn/T/pip-build-env-7_yqfw5c/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 497, in run_setup
super().run_setup(setup_script=setup_script)
File "/private/var/folders/hj/wcklqv7d12b3kxx0z08blw180000gn/T/pip-build-env-7_yqfw5c/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 313, in run_setup
exec(code, locals())
File "<string>", line 23, in <module>
ModuleNotFoundError: No module named 'torch'
[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.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
Originally posted by @saket424 in https://github.com/jhc13/taggui/issues/82#issuecomment-2286796059
Use Python 3.11 or 3.10.
Two problems with installing on Mac (x64): bitsandbytes max version is 0.42.0, but more importantly, the error above is caused because xformers isn't supported on Macs.
Commenting it out in requirements.txt or, more eloquently:
xformers==0.0.25.post1; platform_system == "Linux" or platform_system == "Windows"
I'd push a PR but I'm not allowed. I am on Python 3.12.
I'd push a PR but I'm not allowed.
Why are you not allowed?
I am on Python 3.12.
Use Python 3.11 or 3.10.
I have the same problem. And as I'm running Ubuntu I'm on Python 3.12.3 and can't switch to an older version.
It would be great when more modern Python versions would run as well.
You can install additional versions of Python on Ubuntu.
Hm, I have to look up how to do it as I don't want to wreck my system. Anyway, going older doesn't seem right.
What is the real reason to require so old Python versions? Can't we allow newer ones as well? kohya-ss could also do that step.
Some of the dependencies like PyTorch used to lack support for newer Python versions. I haven't checked if everything supports Python 3.12 now.
PyTorch was bad with newer Python versions. But that's fixed since a few releases: https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix
As I'm on the Ubuntu 24.04 LTS I have no official way of installing an older version of Python. The best way might be by adding a PPA for that. But as I'm pretty sure that old incompatibilities are solved upstream (PyTorch was notorious for that) I prefer to make it work with current python versions instead.
TagGUI now works with Python 3.12.