-
-
Notifications
You must be signed in to change notification settings - Fork 486
Homebrew release can't install plugins that use PyTorch (no PyTorch for Python 3.12 yet) #315
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
Comments
This is really weird. I think it broke because of this: Homebrew/homebrew-core@5b121bf What's surprising is that bottle still depends on |
"An AI to fix dependency hell". One can wish :-) |
Another issue, maybe similar root cause? The error message makes no sense to me. Torch is installed.
|
What version of Torch do you have installed? I have a new plugin that may help debug this. Could you report what you see when you run the following? llm install llm-python
llm python --version
llm python -m pip freeze
llm python -c 'import sys; print(sys.path)' |
|
That ['',
'/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python312.zip',
'/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12',
'/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload',
'/opt/homebrew/Cellar/llm/0.11_1/libexec/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-setuptools/lib/python3.12/site-packages',
'/opt/homebrew/opt/six/lib/python3.12/site-packages',
'/opt/homebrew/opt/pygments/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-certifi/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-tabulate/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-typing-extensions/lib/python3.12/site-packages',
'/opt/homebrew/opt/pyyaml/lib/python3.12/site-packages',
'/opt/homebrew/lib/python3.12/site-packages',
'/opt/homebrew/Cellar/pybind11/2.11.1/libexec/lib/python3.12/site-packages'
] It's got the virtual environment for |
Here's what I get from the same command: /opt/homebrew/bin/llm python -c 'import sys; from pprint import pprint; pprint(sys.path)' ['',
'/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python312.zip',
'/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12',
'/opt/homebrew/Cellar/[email protected]/3.12.0/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload',
'/opt/homebrew/Cellar/llm/0.11_1/libexec/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-setuptools/lib/python3.12/site-packages',
'/opt/homebrew/opt/six/lib/python3.12/site-packages',
'/opt/homebrew/opt/pygments/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-certifi/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-tabulate/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-typing-extensions/lib/python3.12/site-packages',
'/opt/homebrew/opt/pyyaml/lib/python3.12/site-packages',
'/opt/homebrew/opt/python-tabulate/lib/python3.12/site-packages',
'/opt/homebrew/lib/python3.12/site-packages'] It's identical to yours with the exception of that last line, which you have and I do not have:
https://pypi.org/project/pybind11/ is "Seamless operability between C++11 and Python". |
I ran cd /opt/homebrew/Cellar/pybind11/2.11.1/libexec/lib/python3.12/site-packages
find . Output:
|
OK yes! I have recreated the bug. /opt/homebrew/bin/llm install llm-embed-jina Output:
|
Aha!
|
I bet there's no PyPI release for Yes! That's the problem: https://pypi.org/project/torch/2.1.0/#files ![]() |
Signed-off-by: Rui Chen <[email protected]> llm: need `python-setuptools` Signed-off-by: Rui Chen <[email protected]>
I've stopped recommending Homebrew installation for the moment. I updated my blog entry too: https://simonwillison.net/2023/Oct/26/llm-embed-jina/ |
Installing Python apps via Homebrew is generally problematic, has been for me anyway. Brew likes to update Python as often as it updates the other packages in the system, and library dependencies get incrementally out of sync. As Brew does not run pip upgrades. What works today might silently break tomorrow after the next Brew update run. Also, managing a more mainstream Python distribution such as 3.11 along with the latest that Brew might install (is it 3.12 now?) leads to mysterious errors, because indeed the ML related PyPI packages tend to not work with the very latest Python. Often the same with the latest CUDA toolkit. I think you've found a systematic problem in this rabbit hole. Somehow gently guiding users to a venv or conda setup makes things much more stable but also more complicated for newcomers. Not sure what the silver bullet for usability is here, without turning the QuickStart into a small venv tutorial. Some repos just include the venv commands as part of the README flow, but then don't mention what it does. Which is not obvious for getting-started level newcomers. Optimally the README would provide some guidance for an environment-managed upgrade flow, so that later installing something else along with llm does not break llm running in the same env. |
My problem here is that I want my tools to be possible to work with zero knowledge of Python at all. Conda and venv are very much tools for Python developers. I thought I had that with Homebrew, but clearly there are some nasty traps waiting for people that way as well. One option is I could start baking this stuff into Datasette Desktop, which would give me the ability to maintain complete control over the bundled Python without it conflicting with whatever else is going on with their system. |
Ooof, ran into some sort of homebrew python issue. Would it be possible to compile the project into a single binary that includes python? I know it's overhead size wise but that's what I ended up doing for some node.js utilities and UX seems to be better for folks that way. |
I ran into this when installing via pipx too, perhaps because I also recently installed pipx to my machine and it may have resolved to python3.12 unlike most others. Perhaps llm plugins, if they require torch, should also declare python_requires=">=3.7,<3.12", until torch supports >=3.12 in setup.py or pyproject.toml which may make the error more explicit. in any case, torch appears to be available for py3.12 in nightly build ref: pytorch/pytorch#110436 (comment) and this works on my M2 mac > llm install llm-python
> llm python -m pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu
> llm install llm-sentence-transformers |
Here's the PyTorch tracking issue: |
Workaround is now documented here: https://llm.datasette.io/en/latest/setup.html#homebrew-warning |
macOS Sonoma 14.0, M1 Pro
If I go and run:
and try again:
So I do:
and now we are in business.
The text was updated successfully, but these errors were encountered: