fontbakery: ModuleNotFoundError: No module named 'fontforge'
Observed behaviour
When I try to install FontBakery, I get the following error:
Collecting fontbakery (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/a6/19/07b7166d7ff8f95a7beb41ae533a23c283a539f771b0baad0f9983adea04/fontbakery-0.0.13.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-gt4owhmn/fontbakery/setup.py", line 25, in <module>
import fontforge
ModuleNotFoundError: No module named 'fontforge'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-gt4owhmn/fontbakery/setup.py", line 27, in <module>
raise Exception(msg)
Exception: Python module `fontforge` is required. Install it with `apt-get install python-fontforge` or `brew install python; brew install fontforge --HEAD`
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/sr/fzxs628x5gbgjtwscngjdcqh0000gn/T/pip-install-gt4owhmn/fontbakery/
So, I ran:
▶ brew install python; brew install fontforge --HEAD
Warning: python 3.7.3 is already installed and up-to-date
To reinstall 3.7.3, run `brew reinstall python`
Warning: fontforge is already installed
The currently linked version is 20190413
You can use `brew switch fontforge ` to link this version.
Then
▶ brew switch fontforge 20190413
Cleaning /usr/local/Cellar/fontforge/20190413
55 links created for /usr/local/Cellar/fontforge/20190413
But I ended up with the same error as before.
Expected behaviour
I expect FontBakery to install without this error, because I have already install fontforge, as homebrew confirms.
Resources and exact process needed to replicate
Encode Sans at https://github.com/thundernixon/Encode-Sans/tree/4c0afcc9e79bd91238ebb4a834516b93fa128d7b
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (11 by maintainers)
https://stackoverflow.com/a/17153977 :
This is, hands down, one of the stupidest things I’ve ever read.
I think that this may be due to the fact that the Python
fontforgemodule is coming from abrew installof fontforge command line tools (not from pip3 where it doesn’t exist/is not distributed). Looking at the Homebrew Ruby formula for fontforge, it seems that the Python module that it installs is Py2 only. Your Py3 venv can’t import it. The old FB version doesn’t handle the fontforge import exception and chokes…I think 😃
An important thing to remember is that fontbakery does not require fontforge anymore since the latest release from last week.
Hahaha, that is incredible.
But wait … that literally IS in the pip doc.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.pip install --ignore-installed -r requirements.txtmight do it?Here is where you can find (and clear) your pip cache if necessary: https://stackoverflow.com/a/31807659