Glyphs 3 / Python 3 / M1

I had literally just now this very same issue with an own plugin as I am working on making them ready for Glyphs 3 and Big Sur.
In case it’s an objective-c plugin, in the Target > Build Settings > Architectures > “Build Active Architecture Only” must be set to NO. At leat it fixed it here. I guess it’s because otherwise the plugin must be for the exact same architecture as Glyphs and this way the plugin will be also Universal (?). Otherwise, if it’s a python plugin, maybe the binary in there needs an update?

I’m just now have access to my dev unit and will investigate this. And also try to update the Glyphs python module. Hopefully the plugins will works in arm mode then.

1 Like

Let me know if you need another testing machine – I am knee-deep in that G3/M1/P3/OS11 mess :smiley:

I’m two tiny steps further. And now teamviewer crashed. Will get the connection back tomorrow.
Most of the problem is with code signing.

Also I cannot install pyobjc Ising Georg’s method (it seems to attempt to install the latest pyobjc 7.1 but gives me an error). Error messages are quite long and I don’t know which part is relevant.
It may be too soon but I would greatly appreciate an instruction on how to get M1 environment ready for Glyphs scripting, an instruction that works.

I finally got stuff running. I had forgotten how many stuff I needed to istall before doing anything… Anyway, the below is what I had to do to a M1 Mac with Big Sur in order to use Python scripts in Glyphs 3:

Glyphs 3 uses Python 3, so you need 1. Python 3.x as well as 2. pyobjc Python module installed in it.

1
Glyphs 3 has an option to “Install Python Runtime” from the Scripts menu, which enables you to select Python 3.8.2 from Preferences > Addons after restart. However, Scripts menu does not show the scripts installed inside the “Library > Application Support > Glyphs 3 > Scripts” folder and I don’t know why. Once I installed Pyhton 3.9.1 separately, then the scripts started to show up. To do that, you need to download the package below and run the installer.
https://www.python.org/ftp/python/3.9.1/python-3.9.1-macos11.0.pkg
(Note: the latest version is recommended. The latest is 3.9.5 as of this additional note.)

2
This is not enough however, as you will see an error in the Macro window when you run a script, due to the lack of pyobjc Python module. In order to install pyobjc, you need XCode Command Line Tools first (if you skip, the “pip3 install” command will fail). Run the following on Terminal:
xcode-select --install

After this, you can run the following on Terminal:
pip3 install pyobjc

Hurray! Now you should be able to enjoy scripts! Glyphs 3 may need to be restarted after all this.

5 Likes

Thanks for finding this. I always had Xcode installed so it was working for me. And the Glyphs Python module is not working, yet (I’m hopefully getting my M1 MacBook soon to be able to debug it better). In the M1 runtime, the rules for loading binaries have changed (notarization stuff) and I didn’t figure that out, yet.

1 Like

Hey crew,
I’ve done all of the steps above and am still getting a “the bundle couldn’t be loaded” message for every plug-in on startup. I’ve restarted the computer completely.

Mac Mini M1, Big Sur 11.1

When i was in terminal, it gave this additional message about updating the pip version from 20.2.3 to 20.3.3:

Screen Shot 2021-01-19 at 10.47.07 AM

Sticking with g2 until plugins work. But then, you know I love vintage software. #fontographerstillrules

john

The pip update it not critical.

But as far as I can see, the setup is OK. Can you check what you have set in Preferences > Addons > Python Version?

(I’ll get my own M1 mac in the next few days and then I can work on the python environment much easier)

Python 3.9.1 (Python.org)

Can you run this in terminal:

file /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 

And what happens if you run this in the Macro Window:

import objc
print(objc)
1 Like

First:

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (for architecture x86_64): Mach-O 64-bit executable x86_64

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (for architecture arm64): Mach-O 64-bit executable arm64

Second:

<module 'objc' from '/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/objc/__init__.py'>

Also, I removed and reinstalled all the plug-ins, and on relaunch, all but two (extrude tool and global glyph) appear to have loaded.

However, now attempting to open any existing font file freezes it. I can create a new document, but existing ones crash it immediately.

John

Can you send a few of the crash reports? And do you have the latest cutting edge version?

Cutting edge 3.02 (3053) now opens existing files! Hopefully that did it. thanks.

I’m having trouble with this too on a new M1.

I’ve installed the pyobjc package, but still get the popup saying “There is no compatible version of Python 3 installed”, when running any script in the macro panel. Python 3.8.2 is showing up in Glyphs Addons Preferences.

Is it required to install Python 3.9 from the downloadable package as described above? I prefer to use pyenv for installing/managing new versions of python, and have already installed 3.9 in this way. Is there a way to use the pyenv version instead? Or is there a way to just make the system 3.8.2 work?

I’ve tried on both stable and cutting edge(3.0.3 3060) versions of Glyphs

Yes, ignore the Glyphs’s Python 3.8.x and install 3.9 (at least it didn’t work for me otherwise).

Thanks for the note Tosche.

So to confirm, there’s no way to use a Pyenv installed version of Python instead?

You might. If that version contains a Python.framework. Run this in the macro window in Glyphs

Glyphs.defaults["GSPythonFrameworkPath"] = "Full/path/to/Python.framework"

or in Terminal

defaults write com.GeorgSeifert.Glyphs3 "GSPythonFrameworkPath" "Full/path/to/Python.framework"
1 Like

Hi guys,

I did all the steps Toshi mentioned and I got some of the scripts to work. But for example Remix Tools doesn’t work still and others like tops and bottoms. I have the Python 3.9 installed and Glyphs recognizes but then still asks for more.
Thank you

The remix tools should work. Do you have the latest version?