zsh: /Users/MYUSERNAME/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/Current/bin/pip3: bad interpreter: ./python3.11: no such file or directory
Questions:
Since there is no existing Scripts/site-packages folder, do I have to manually create one?
In a comment above you mention replace ~ with the path of your user folder, do I have to do that in this case?
This is annoying. It seems works for me. Need to investigate.
If someone likes to try. The pip3 file is actually a python script that can be edited. I removed the absolute path to the python binary in the first line at tried to make it relative.
Somehow the âofficialâ Python still seems to be referenced in there somewhere:
> cd "/Users/kuti/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/Current/bin"
> ./python3.11
dyld[84062]: Library not loaded: /Library/Frameworks/Python.framework/Versions/3.11/Python
Referenced from: <DAEA9A8A-1F43-3E78-A8D3-A4275D00B4E5> /Users/kuti/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.11/bin/python3.11
Reason: tried: '/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file, not in dyld cache)
zsh: abort ./python3.11
This may be depending on the shell you are using, but for zsh:
~ is expanded to your user folder, but only if the whole path is not typed with surrounding quotes. Without quotes, you have to escape the spaces thoughâŚ
So ~/Library/Application\ Support works, but "~/Library/Application Support" doesnât.
If youâre running the latest stable Glyphs 3.1.2, then Scripts/site-packages is not in the PYTHONPATH environment variable for GlyphsPython. Once youâve installed your dependencies there, you need to start your scripts with this:
Following last Georg instructions, modules are correctly installed in Scripts/site-packages, but most of installed module return error when I tried to import them in Glyphs.
Hyperglot is the only one that works.
Most of the error indicates that a module is compiled for the âx86_64â architecture but my system requires the âarm64â architecture, leading to an architecture incompatibility issue.
If we could have something similar to the âInstall Python PackagesâŚâ feature from Drawbot, that would be fantastic
Then get to the Terminal app in Finder, hit Cmd+i. In the info box, there should be a checkbox âuse Rosettaâ (or similar). Uncheck it. Restart Terminal. The uninstall all modules and install them again.
Most of module work, but I have a issue similar to @jkutilek.
With python-fontbro module I got :
Traceback (most recent call last):
File "<macro panel>", line 1
File "__init__.py", line 1
from fontbro.font import Font
File "font.py", line 6
from curses import ascii
File "__init__.py", line 13
from _curses import *
ImportError: dlopen(/Users/hugojourdan/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_curses.cpython-311-darwin.so, 0x0002): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.11/lib/libncursesw.5.dylib
Referenced from: <4891AC09-81E7-34E9-A8E9-D072F4EE559A> /Users/hugojourdan/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.11/lib/python3.11/lib-dynload/_curses.cpython-311-darwin.so
Reason: tried: '/Library/Frameworks/Python.framework/Versions/3.11/lib/libncursesw.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/lib/libncursesw.5.dylib' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/lib/libncursesw.5.dylib' (no such file), '/usr/lib/libncursesw.5.dylib' (no such file, not in dyld cache)
Has anyone made any progress on this? I would like to be able to use pip to install dependencies in GlyphsPython, without the user being required to install another Python.
@GeorgSeifert mentioned that pip was added to GlyphsPython last October, but it doesnât work. Everything in the GlyphsPython bin folder points to /Library/Frameworks/Python.framework/⌠which is where Python.org installations live. Is there a working Python (or pip) executable anywhere inside of GlyphsPython that can be run from the command line? I canât find one.
Another problem that may need to be solved before pip can be used in GlyphsPython is that setuptools is apparently missing. The pip module is there, but I get various errors indicating setuptools is missing if I try to run pip via runpy, and if I try to run ensurepip. Try running these in the Macro window:
The ensurepip.bootstrap method complains that a specific wheel of setuptools is missing, but if I go dig up that exact file from pypi and run it again, Glyphs gets a permanent spinning wheel and stops responding.
That doesnât work for me. Do you have 3.11 installed somewhere else? GlyphsPythonâs pip command has its shebang pointing to ./python3.11, which is some kind of executable that runs Python by looking for it in Library/Frameworks and System/Library/Frameworks. I just get errors that it canât find 3.11 in those locations.
âŚit doesnât work because of the relative shebang in pip3.
zsh: /Users/justinpenner/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/Current/bin/pip3: bad interpreter: ./python3.11: no such file or directory
If I go to the GlyphsPython bin folder first before running your command, then I get this errorâŚ
dyld[75363]: Library not loaded: '/Library/Frameworks/Python.framework/Versions/3.11/Python'
Referenced from: '/Users/justinpenner/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.11/bin/python3.11'
Reason: tried: '/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file)
zsh: abort install -t ~/Library/Application\ Support/Glyphs\ 3/Scripts/site-packages
âŚbecause the relative shebang (bin/python3.11) is now found, but that executable canât find any installations of Python 3.11.
ETA: It seems like the real Python executable is the file called Python with a capital P, up one level from the bin folder. bin/python3.xx appears to be a binary executable that is some sort of wrapper that should be looking for Python in ../ but instead is looking for it in the absolute path for a typical Python installation. This seems to be somewhat related to this issue and this issue.
This is odd as Georgâs command also works for me. Have you tried reinstalling the Python module in Glyphs? I have both the Python executable that you mentioned a level up and python3.11 in bin.
@georgeyjm you probably have Python 3.11 installed in /Library/Frameworks or /System/Library/Frameworks. Georgâs command shouldnât work unless you have a Python distro installed in one of those locations.
@GeorgSeifert This is getting far out of my depth, but I suspect the solution would involve modifying some of bin/pip* and bin/python* binary files, either by editing directly or rebuilding from source. Those are the command line executables which wrap the ../Python interpreter library. It might be a lot of work to fix them, so I donât know if it would be worth the effort.
For now, if anyone is building a GlyphsApp plugin that requires dependencies to be installed via pip, the user must install Python separately to get a working copy of pip. It does not need to be the same Python version as GlyphsPython (currently 3.11) as pip can be tricked into installing packages for other Python versions with the --python-version argument.
Hereâs the command Iâm currently using in the README.md of my plugin. This works with any Python selected in Glyphs > Preferences > Addons, but the user must replace the version number in this command with whatever Python version they are using in Glyphs.