Eduard Florinescu
Eduard Florinescu

Reputation: 17521

Python doesn't see the module installed with apt-get

sudo apt-get install --reinstall python-fontforge

installs with no error

Preparing to unpack .../python-fontforge_20120731.b-7.1_amd64.deb ...
Unpacking python-fontforge (20120731.b-7.1) over (20120731.b-7.1) ...
Setting up python-fontforge (20120731.b-7.1) ...

but python still is unable to see the module

  File "/usr/local/bin/smoothscan-fontgen.py", line 23, in <module>
    import fontforge
ImportError: No module named fontforge

I install it with apt-get since pip doesn't find it

Looking in the lib I see this:

/usr/lib/python2.7/dist-packages/fontforge-1.0.egg-info
/usr/lib/python2.7/dist-packages/fontforge.so

python version:

Python 2.7.11 :: Continuum Analytics, Inc.

I want to mention that this happened after conda updated my python version

Upvotes: 0

Views: 2005

Answers (3)

NeoVe
NeoVe

Reputation: 3897

Try it like this (not tested):

sudo apt-get install fontforge python-fontforge

Then:

python -c 'import fontforge; print "FontForge works in Python"'

Tell me if that works, Thank You

EDIT

Since it appears to be installed, try running it like this:

fontforge -lang=py -script my_script.py

SECOND EDIT

Maybe the fontforge you are using is not built with python support, if you download the code, please try this:

$ ./configure --enable-pyextension
$ make
$ sudo make install

Then you could use it from inside python console:

>>> import fontforge

More info: Compile fontforge with python support

Upvotes: 1

gerosalesc
gerosalesc

Reputation: 3063

I suggest you reinstall your original python installation unless you want something else broken in your system:

for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep python | awk '{print $1}'`; do  apt-get -y --force-yes install --reinstall $pkg ; done

This will reinstall everything related to python and Python itself. Taken from here

Upvotes: 3

Maorg
Maorg

Reputation: 83

have you tried:

$ sudo apt-get install fontforge python-fontforge

https://pypi.python.org/pypi/ufo2otf/0.1.0b

Upvotes: 0

Related Questions