Python package locations

I think this isn't a font technology specific problem but I think people here have definitely had this issue before. 
I installed fontTools with pip and it's located in

/usr/local/lib/python2.7/site-packages

It seems Fontlab and Glyphs App both expect it to be in

/Library/Python/2.7/site-packages/

What's the correct way to fix this? Can one add some kind of link to /Library/Python/2.7/site-packages/ telling both apps that it's in the former location? Or should it be installed in /Library/Python/2.7/site-packages/ anyway (how?)
Tagged:

Comments

  • Kent Lew
    Kent Lew Posts: 937
    Can’t you just use a .pth file as a redirect?
    It’s been a while since I did this, so someone else will correct me if I’m wrong. Create a text file and name it “fontTools.pth”. The contents will be simply the path to your installation, just as you have it above (but with a trailing “/”). Place this .pth file in the directory where Fontlab and Glyphs are looking for fontTools.
    See if that works.

  • Glyphs doesn’t expect a specific location. It relies on the sys.path of the system python to include the path where the module is installed. 
  • You can specify pip package install locations with -t, but I don't think this is what you are after. If you are using a different pip than your system python/pip it will likely cause other issues down the road, even if you can point to the right site-packages.

    Make sure any other than the system pre-installed python/pip are run as separate binaries (e.g. brew python installs them as python2 or python3 to avoid collisions) and only install fonttools with pip once you are positive it’s the system pre-installed version and target directory for package installs.

    If you ever need to pip install anything for a specific project it’s a good idea to use either virtualenv or better yet pyenv to manage separate python environments for each project. For programs that look for packages in default locations you can then use the system pip to install packages, as an exception to the rule, so to say.

  • Thanks for the advice, I ended up symlinking it into the folder,
    @Georg Seifert I see.. the former folder is definitely in the sys.path.