-
Notifications
You must be signed in to change notification settings - Fork 2
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
crash #23
Comments
Did you install pandas? It's a new dependency since I implemented the new TalkingLeaves.data module. You can just run the pip command from the README to install it. The roadmap for TalkingLeaves includes eventually handling dependency installs automatically via the GUI (see #2), but it's complicated at the moment because GlyphsPython doesn't have pip built-in. |
I just installed
|
After messing with things I’d rather not want to mess with (a.k.a. dependency hell), I got it to work. I doubt that most users of TalkingLeaves would be willing to spend the time and effort on this. I installed pandas using this snippet from within Glyphs and now it works again. Not sure whether this is the expert way of doing things, I’m a dummy at handling multiple Python versions and installing dependencies. |
That error is in fact identical to the earlier one you posted.
That's a clever way to do it, but you installed it to a I spent a lot of time in dependency hell when I was working out the best way to install dependencies for TalkingLeaves. The best pointer I can give you is to understand how module names work and where Python searches for them. Module names are just folder and/or file names, so import sys
for p in sys.path:
print(p) If I run that in Glyphs, I get a list like this:
|
I'm also getting a crash. Nothing in output though. I suspect it happened after upgrading to Sonoma. I tried re-running the command in the readme to no avail. Will keep poking at it trying to get it to throw an error.. |
So there isn't a popup window with an error message, or anything in the Glyphs macro window? That would be hard to diagnose unless I can reproduce it on my machine, but I'm running Monterey right now. Let me know if you come up with any details or error messages that might be useful. Just double-checking, but make sure to use the pip command from the latest readme, which installs both |
No output unfortunately... maybe on a system level somewhere but not sure when it's Glyphs python. |
Not sure whether this helps but apparently you can specify dependencies in the Plugin Manager. This might be more convenient for the user than asking them to follow specific installation instructions. |
That sadly does not work with some of the dependencies of this plugin. HarfBuzz, as part of hyperglot, I believe, cannot be installed this way. We are currently looking into offering PIP for the Glyphs Python such that you could list your requirements directly and PIP installs them as per usual. One major question is what happens if different plugins require different versions of the same package. Since there is just on unified Python runtime inside Glyphs (for performance and memory efficiency and the chance of plugins/scripts to talk to each other, if needed), we cannot load different versions for different plugins. |
Thanks for the details. I kind of knew I was probably missing something. |
That's correct, a few packages including HarfBuzz, unicodedata2, and PyYAML install different sets of binaries depending on the user's OS, chipset, and Python version. So the Plugin Manager cannot install those, since it only downloads a repo and then makes an alias to a specified folder within it.
I'm working on a module (mainly for TalkingLeaves, but it will be designed for other plugins to use) that wraps pip, and might be used like this: from glyphspip import GlyphsPip
try:
import hyperglot
except ImportError:
hyperglot = None
class ____PluginClassName____(GeneralPlugin):
@objc.python_method
def settings(self):
if hyperglot is None:
pip = GlyphsPip(pluginName="PluginName")
pip.require(
requirements=["hyperglot"],
successCallback=self.dependencies_installed,
)
@objc.python_method
def start(self):
pass
@objc.python_method
def dependencies_installed(self):
global hyperglot
import hyperglot
But for this module to work, the user would still need to install Python on their system, until the GlyphsApp team can get pip working inside of GlyphsPython.
I have thought about this. The solutions that come to mind are limited: a) keep all pip packages updated, so plugins are forced to support the latest version of their dependencies, or b) allow plugins to specify versions using the standard pip syntax with ==, >=, >, <=, <, and resolve conflicts between plugins by choosing the later version and therefore breaking the outdated plugin. Or c) the same as (b) except notify the user and ask them to choose which plugin to break. With option (a) the developer could choose to bundle their own fixed version of a package, but they would need to edit the code inside that package to add a prefix to all local imports. And to enforce option (a) the GlyphsApp team would need to move It would also be handy to have a small GUI where the user can see a list of installed packages, add/remove/clear all, as well as enter the name of any pypi package to install it. That is on my roadmap for my "GlyphsPip" project, but whether I implement it probably depends on what the GlyphsApp team are working on. |
PIP should work in the latest Glyphs Python, see: |
Fantastic! I wasn't aware it was fixed. It seems to work for me after removing all other Python frameworks from my system. |
Yeah, wrangling Python can be complicated. Removing all other versions should not be necessary, we’ll look into why that might be. Let us know of any other issues; this is still very much work in progress as there is not one true solution™ to managing Python dependencies. |
I should have clarified: removing all other Python versions is only necessary to test whether the fix for GlyphsPython's pip is working. Previously, GlyphsPython's pip was working for some people but not others, because it was broken but it was able to fall back to another Python version if it was available in certain locations such as |
Details:
Traceback (most recent call last):
File "plugin.py", line 48, in openWindow_
from TalkingLeaves import TalkingLeaves
File "init.py", line 19, in
import TalkingLeaves.data as data
File "data.py", line 2, in
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
App:3.3-3311 Plugin:0.1-2 System:14.5.0
The text was updated successfully, but these errors were encountered: