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

No API detected #1

Closed
olitreadwell opened this issue Aug 8, 2023 · 9 comments
Closed

No API detected #1

olitreadwell opened this issue Aug 8, 2023 · 9 comments

Comments

@olitreadwell
Copy link

My attempts to use this result in 'No API detected'

I have tried to run the suggested action by pressing enter.

I have also run 'harvest'

Same issue continues to occur.

@BenjaminOddou
Copy link
Owner

BenjaminOddou commented Aug 8, 2023

Hello @olitreadwell, it seems the api is not built correctly. First, delete any file in ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.benjamino.emoji_wine. Then check that you have python 3.8 or above with python --version and ensure you have pillow with brew info pillow command in your terminal. If everything seems ok, would you mind opening the Alfred debugger and telling me what's the error message ? See here on how to use it.

Edit: to install dependencies.

@BenjaminOddou
Copy link
Owner

@olitreadwell could you try using the latest release v1.2.2 ?

@vitorgalvao
Copy link

@BenjaminOddou You’re hardcoding pillow_dir = '/usr/local/Cellar/pillow' which will not work on Apple Silicon Macs, because Homebrew installs to /opt/homebrew there.

@stan-voo
Copy link

stan-voo commented Aug 9, 2023

Installing dependencies has worked for me.

@BenjaminOddou
Copy link
Owner

BenjaminOddou commented Aug 9, 2023

@BenjaminOddou You’re hardcoding pillow_dir = '/usr/local/Cellar/pillow' which will not work on Apple Silicon Macs, because Homebrew installs to /opt/homebrew there.

@vitorgalvao thanks for pointing that out. Do you have the full path of pillow dependency installed via homebrew with apple silicon chips ? I'll recode that part. Don't hesitate to make a pull request

@vitorgalvao
Copy link

It follows the same pattern: /opt/homebrew/Cellar/pillow. But is it worth doing at all? Seems like this was just a matter of missing dependencies. Alfred already includes both Homebrew paths so no need to link to the specific Python version or anything.

A suggestion is to instead try to run a simple pillow command and on failure tell the user they may be missing the dependency. You can open alfredpreferences://navigateto/workflows>resolvedependencies to send people directly to the dependencies manager.

@BenjaminOddou
Copy link
Owner

It seems that when running the python script, the pillow dependency installed with homebrew is not included in pythonpath by default.

@vitorgalvao
Copy link

Check the Dependencies Manager. Does Python ask to be installed? Homebrew separates python per version and that matters regarding which version Pillow is built against.

@BenjaminOddou
Copy link
Owner

BenjaminOddou commented Aug 9, 2023

I have python 3.11 installed and my pillow version is located here /usr/local/Cellar/pillow/10.0.0.

==> pillow: stable 10.0.0 (bottled), HEAD
Friendly PIL fork (Python Imaging Library)
https://python-pillow.org
/usr/local/Cellar/pillow/10.0.0 (243 files, 4.6MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-07-17 at 21:23:55
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/pillow.rb
License: HPND
==> Dependencies
Build: pkg-config ✔, [email protected] ✔, [email protected] ✔
Required: jpeg-turbo ✔, libimagequant ✔, libraqm ✔, libtiff ✔, libxcb ✔, little-cms2 ✔, openjpeg ✔, tcl-tk ✔, webp ✔
print(sys.path)
['~/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8B870FAD-33DF-4867-AF18-0FE255A691FF', '/usr/local/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python311.zip', '/usr/local/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11', '/usr/local/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/lib-dynload', '/usr/local/lib/python3.11/site-packages']

The problem is that /usr/local/Cellar/<Homebrew package>/nested_folder/ link is not included in the path. Normally I would include a ./lib folder path if the library was bundled but this time it's a bit trickier.

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

4 participants