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

Python can't find _minify.so #693

Closed
samuelbradshaw opened this issue May 4, 2024 · 1 comment
Closed

Python can't find _minify.so #693

samuelbradshaw opened this issue May 4, 2024 · 1 comment

Comments

@samuelbradshaw
Copy link

samuelbradshaw commented May 4, 2024

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:

Screenshot 2024-05-03 at 9 27 17 PM

Any ideas?

@tdewolff
Copy link
Owner

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!

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

No branches or pull requests

2 participants