Closed jcushman closed 1 month ago
Aha, I had a broken numpy install in homebrew's python somehow. This fixed it:
rm -r /usr/local/lib/python3.12/site-packages/numpy*
Feel free to close this, except: I wonder if include-system-site-packages = true
in the brew pyvenv.cfg
is correct. I don't know anything about brew packaging though.
I experienced the same issue today after executing brew update
.
The first thing I discovered were warnings when listing installed Python packages:
$ python3.12 -m pip list
WARNING: Skipping /opt/homebrew/lib/python3.12/site-packages/certifi-2024.7.4.dist-info due to invalid metadata entry 'name'
WARNING: Skipping /opt/homebrew/lib/python3.12/site-packages/numpy-2.0.0.dist-info due to invalid metadata entry 'name'
Reinstallation was not possible:
$ python3.12 -m pip install --force-reinstall numpy
error: externally-managed-environment
Γ This environment is externally managed
β°β> To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
brew
refused to install numpy
, saying it's already there, just not linked.
$ brew install numpy
Warning: numpy 2.0.0 is already installed, it's just not linked.
To link this version, run:
brew link numpy
Linking numpy
failed:
$ brew link numpy
Linking /opt/homebrew/Cellar/numpy/2.0.0...
Error: Could not symlink bin/f2py
Target /opt/homebrew/bin/f2py
already exists. You may want to remove it:
rm '/opt/homebrew/bin/f2py'
...but llm
started working again, and the pip
warnings disappeared when listing installed packages.
I won't say if this solution is better or not. I'm also not sure if this solution is correct regarding the multiple Python versions one can have installed (with Homebrew) as well as other Python version managers, but it works for me.
Nevertheless, as a user, I think that it is a bug with llm
or rather its Homebrew configuration that should be resolved before closing this issue. It should not be necessary to perform all those steps.
I've seen this too. It's really frustrating. I think the solution may be to add numpy
as an explicit Homebrew dependency to avoid this from happening.
I'm going to fix this in sqlite-utils
itself.
OK, I've bumped the sqlite-utils
dependency to workaround this. Unfortunately it won't be available through Homebrew until a day or two after the next LLM release (which I hope to push shortly).
I just did
brew install llm
on MacOS Sonoma 14.5 on an Intel Mac.llm --help
then fails with a stacktrace:Not sure if related to this numpy bug about removing type aliases, or something about my Intel platform. Let me know if I can share any more info about my setup to debug.