veltzer / openbook

OpenBook is an open source Jazz real book
https://veltzer.github.io/openbook/
GNU General Public License v3.0
281 stars 44 forks source link

Problem with compiling on OSX [resolved] #15

Closed captbaritone closed 11 years ago

captbaritone commented 11 years ago

I had a dependency issue when trying to compile Openbook on OSX. It ended up being a problem with my environment, but I thought I would report it here in case someone else had the same problem, or knows a more proper solution.

When trying to make the pdfs on my OSX machine, I was getting the following error:

doing [out/openbook.ly]
Traceback (most recent call last):
  File "scripts/mako_book.py", line 4, in <module>
    import mako.template
ImportError: No module named mako.template
make: *** [out/openbook.ly] Error 1

I checked that I had mako installed (via pip):

$pip show mako

---
Name: Mako
Version: 0.8.1
Location: /usr/local/lib/python2.7/site-packages
Requires: MarkupSafe

I gave up.

captbaritone commented 11 years ago

After some Googling, I found this Stack Exchange post which gave me the right lead:

I had two different python binaries, and the one called by the script was not the first one in my path. My path (and pip) were using /usr/local/bin/python whereas the shebang in scripts/mako_book.py was /usr/bin/python.

I'm guessing other OSX users who installed python and pip via homebrew will have a similar problem. I am no python expert, but some light googling showed that one generally accepted solution is to use this shebang: #!/usr/bin/env python which allows the system to intelligently find the user's preferred python binary.

I propose that this would probably allow for less error-prone build for many (especially OSX) users. That being said, I don't know enough about python to know if there is some good reason not to do this.

veltzer commented 11 years ago

There are actually good reasons not to do this since this means that the system python will not be used and since we need lots of python packages I rather people used the systems package manager to install the pre-requisites than use pip... But I merged it anyway since it won't hurt most users...