title: Lua error loading module 'libpng' (Torch, MacOSX)
body: <p>How do I make libpng load properly in Lua?  I am running Lua/Torch in iTorch Notebook in Mac OSX 10.10.3, where other basic functions in Lua work, such as plotting and calculations.  </p>
  
  <pre><code> brew install libpng
  </code></pre>
  
  <blockquote>
    <p>Warning: libpng-1.6.17 already installed</p>
  </blockquote>
  
  <p>If I run:</p>
  
  <pre><code>require 'nn';
  require 'image';
  itorch.image(image.lena())
  </code></pre>
  
  <blockquote>
    <p>error loading module 'libpng' from file '/usr/local/lib/lua/5.1/libpng.so':
        dlopen(/usr/local/lib/lua/5.1/libpng.so, 6): Library not loaded: /usr/local/lib/libpng15.15.dylib
      Referenced from: /usr/local/lib/lua/5.1/libpng.so
      Reason: Incompatible library version: libpng.so requires version 33.0.0 or later, but libpng15.15.dylib provides version 29.0.0
    warning:  could not be loaded (is it installed?)
    /usr/local/share/lua/5.1/dok/inline.lua:736:  libpng package not found, please install libpng
    stack traceback:
        [C]: in function 'error'
        /usr/local/share/lua/5.1/dok/inline.lua:736: in function 'error'
        /usr/local/share/lua/5.1/image/init.lua:142: in function 'saver'
        /usr/local/share/lua/5.1/image/init.lua:355: in function 'save'
        /Users/MY/torch/install/share/lua/5.1/itorch/gfx.lua:25: in function 'f'
        [string "local f = function() return itorch.image(iii)..."]:1: in main chunk
        [C]: in function 'xpcall'
        /Users/MY/torch/install/share/lua/5.1/itorch/main.lua:177: in function 
        /Users/MY/torch/install/share/lua/5.1/lzmq/poller.lua:75: in function 'poll'
        /Users/MY/torch/install/share/lua/5.1/lzmq/impl/loop.lua:307: in function 'poll'
        /Users/MY/torch/install/share/lua/5.1/lzmq/impl/loop.lua:325: in function 'sleep_ex'
        /Users/MY/torch/install/share/lua/5.1/lzmq/impl/loop.lua:370: in function 'start'
        /Users/MY/torch/install/share/lua/5.1/itorch/main.lua:344: in main chunk
        [C]: in function 'require'
        [string "arg={'/Users/MY/.ipython/profile_default/secu..."]:1: in main chunk</p>
  </blockquote>