Reputation: 5093
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.
brew install libpng
Warning: libpng-1.6.17 already installed
If I run:
require 'nn';
require 'image';
itorch.image(image.lena())
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
Upvotes: 1
Views: 2608
Reputation: 46
I had a similar problem (OSX 10.9.5). You probably have multiple versions of libpng installed, with the one called during install of luarocks having architecture i386 (x86_64 required).
To solve this:
Try installing image again, and reading the log:
luarocks install image
Check the log to see if you get a message of type:
ld: warning: ignoring file /Library/Frameworks//libpng.framework/libpng, missing required architecture x86_64 in file /Library/Frameworks//libpng.framework/libpng (2 slices)
If this is the case (assuming using brew) remove the libpng framework in /Library/Frameworks and do a
brew install libpng --universal
Reinstall image and run.
This worked for me, I hope it works for you too.
Upvotes: 3
Reputation: 2266
Reinstalling the image package as well as forcing the linkage of libpng might fix it:
brew link libpng --force
luarocks install image
Upvotes: 1