Install Python Package in Glyphs3 (Python 3.9.1 (Glyphs))

Hi there,

Python newbie here. I’m working on a couple scripts that require me to import modules from the opentamil package here: GitHub - msathia/Ezhil-Lang: Ezhil-Lang : எழில் - ஒரு தமிழ் நிரலாக்க மொழி; தமிழ் மாணவர்களுக்கு இது முதன் முறை கணிப்பொறி நிரல் ஏழுது உதவும் (Ezhil, is a fun Tamil programming language for K-12). See: http://ezhillang.org/
Now I have installed it via pip on my mac, but I don’t think the python in Glyphs3 picks this up. Because every time I try to execute code with these lines:
from tamil import utf8
I get an error:

ModuleNotFoundError: No module named 'tamil'

I’m sure I am getting something very fundamental wrong here, but I can’t seem to figure it out why. Would really appreciate the help!

Cheers,

For Glyphs, typically it’s best to install Python from the Plugin Manager. This Python version is optimized to work with most Glyphs scripts. You can see which Python version Glyphs is using by going to GlyphsSettings…Addons. There, the one from the Plugin Manager shows up with “(Glyphs)” at the end.

However, if you install custom packages with pip, these packages do not get installed for the (Glyphs) Python. Instead, pip installs packages for the Python version that you Mac normally uses.

So, you need to switch Glyphs to use the Python version for which you have installed the custom packages. Do this by going to the Addons settings in Glyphs and selecting the other Python version. You need to relaunch Glyphs for the newly selected Python version to be used.

But: Before you relaunch Glyphs, make sure that you have the pyobjc package installed. Install it like you installed the other packages with pip. Then relaunch Glyphs.

1 Like

Thanks Florian, this worked!