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

Find homebrew folder #458

Closed
wants to merge 1 commit into from
Closed

Find homebrew folder #458

wants to merge 1 commit into from

Conversation

hugobranquinho
Copy link

Hello,

Failing to use on macos with error:

OSError: cannot load library 'libvips.42.dylib': dlopen(libvips.42.dylib, 0x0002): tried: 'libvips.42.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibvips.42.dylib' (no such file), '/usr/lib/libvips.42.dylib' (no such file, not in dyld cache), 'libvips.42.dylib' (no such file), '/usr/lib/libvips.42.dylib' (no such file, not in dyld cache).  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libvips.42.dylib'

Not sure why, but for mac M* the homebrew folder is different by default. My homebrew folder is /opt/homebrew, tried with the following change and worked fine. Let me know what you think.

Thanks!

@jcupitt
Copy link
Member

jcupitt commented Mar 22, 2024

Hi @hugobranquinho,

Did you see:

https://docs.brew.sh/Homebrew-and-Python

So (I think!) you need to install the homebrew python, make a venv, then install pyvips and it should work.

@hugobranquinho
Copy link
Author

Hi @jcupitt

Thanks for the quick response!

I tried to use homebrew with python before and had some issues (it was a long time ago, didn't test again)
But, it doing that means that the usage of pyvips is only allowed to a homebrew setup right?
Would make sense to make it work for all setups?

Thanks

@jcupitt
Copy link
Member

jcupitt commented Mar 22, 2024

Or you can set your PYTHONPATH or library path to include the homebrew lib area. I think that's better than wiring magic paths into pyvips.

I think there's another problem -- pyvips has two main modes, API and ABI. You've patched the ABI startup path, but you should really be using API mode (it's quite a bit faster).

Probably when you installed pyvips you had not set up your shell for homebrew, so pyvips could not find the libvips headers.

I think you need to adjust your shell setup so that pkg-config is working, then try installing pyvips again. You'll probably need a venv too (python insists on this now).

@hugobranquinho
Copy link
Author

Thanks for the quick response! Sorry for my delayed one.

I'm on python3.8 (not installed by homebrew) and using a venv, made some changes and now python can find homebrew libs.
Thanks for the help! Closing this PR.

Amazing lib! 🙌

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

Successfully merging this pull request may close these issues.

2 participants