Python can't find _minify.so
samuelbradshaw opened this issue · comments
Hi! I'm on a Mac with Apple silicon. I installed minify with brew:
brew install tdewolff/tap/minify
Then I installed the python bindings:
pip3 install tdewolff-minify
However, when I try to import minify
in my Python script, I get this error:
Traceback (most recent call last):
File "/Users/sbradshaw/Desktop/Offline/Git-Church/gospel-library-v5-schema/v4_to_v5_styles.py", line 12, in <module>
from ldssource_minifier import ldssource_minifier
File "/Users/sbradshaw/Desktop/Offline/Git-Church/gospel-library-v5-schema/ldssource_minifier/ldssource_minifier.py", line 5, in <module>
import minify
File "/Users/sbradshaw/.pyenv/versions/3.11.8/lib/python3.11/site-packages/minify/__init__.py", line 9, in <module>
lib = ffi.dlopen(str(pathlib.Path(__file__).parent / '_minify.so'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: cannot load library '/Users/sbradshaw/.pyenv/versions/3.11.8/lib/python3.11/site-packages/minify/_minify.so': dlopen(/Users/sbradshaw/.pyenv/versions/3.11.8/lib/python3.11/site-packages/minify/_minify.so, 0x0002): tried: '/Users/sbradshaw/.pyenv/versions/3.11.8/lib/python3.11/site-packages/minify/_minify.so' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sbradshaw/.pyenv/versions/3.11.8/lib/python3.11/site-packages/minify/_minify.so' (no such file), '/Users/sbradshaw/.pyenv/versions/3.11.8/lib/python3.11/site-packages/minify/_minify.so' (no such file)
It seems to be looking for _minify.so
under site-packages/minify
, but I don't have that file:
Any ideas?
Hm, first of all you don't need to install minify
using Homebrew to use it with Python. The first installs a command line utility minify
, while Python installs a Python package that builds on the minify library (not command line).
Second, the Makefile had a bug and the GitHub workflow as well. I've fixed those and that should work for you already. Thirdly, I've fixed the MacOS binary build, that should also fix it for you as the pip installer doesn't need to build it anymore (no need for Go!).
Please try v2.20.21 and let me know if it works!