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

Fix-nonhinting produces ImportError: cannot import name 'parse' from 'gflanguages' #1075

Open
kosbarts opened this issue Jan 15, 2025 · 6 comments

Comments

@kosbarts
Copy link

Hi, I am trying to run fix-nonhinting on a variable font and I am getting the following error:

Traceback (most recent call last):
File "/Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/bin/gftools", line 8, in
sys.exit(main())
File "/Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages/gftools/scripts/init.py", line 97, in main
mod = import_module(f".{module}", package)
File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages/gftools/scripts/fix_nonhinting.py", line 53, in
from gftools.fix import fix_unhinted_font
File "/Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages/gftools/fix.py", line 15, in
from gftools.util.google_fonts import _KNOWN_WEIGHTS
File "/Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages/gftools/util/google_fonts.py", line 41, in
from gflanguages import LoadLanguages, parse
ImportError: cannot import name 'parse' from 'gflanguages' (/Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages/gflanguages/init.py)

Any ideas what is causing it?
I am running gftools 0.9.77.dev10+gb025165 and I haven't had issues with previous versions.

@simoncozens
Copy link
Contributor

Make sure you have gflanguages>=0.7.0; we added the parse function about a year ago!

@kosbarts
Copy link
Author

kosbarts commented Jan 15, 2025

How do I install it? Isn't it part of gfttools?

I ran pip install -U gflanguages and I got this:
Requirement already satisfied: gflanguages in /Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages (0.8.9)
Requirement already satisfied: protobuf<4,>=3.7.0 in /Users/kostas/[email protected]/Foundry5_Fonts/Peridot/venv/lib/python3.9/site-packages (from gflanguages) (3.20.3)

@simoncozens
Copy link
Contributor

Requirement already satisfied: gflanguages ... (0.8.9)

Ah, OK, this version was released by mistake with a bad version number and then soon yanked afterwards. Looks like you installed things at a very unlucky time. If you have gflanguages in your requirements.txt, remove it. Then delete your venv and recreate it.

@kosbarts
Copy link
Author

I just updated the venv today! How unlucky was I?!

Thanks so much. I'll delete and recreate it.

@kosbarts
Copy link
Author

I can't install nothing on a new venv. Getting this stupid message:
...
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command '/usr/bin/clang' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cmarkgfm
Failed to build cmarkgfm
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (cmarkgfm)

@simoncozens
Copy link
Contributor

Google has lots of results for that error message. :-) Try running xcode-select --install.

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

2 participants