DIYBookScanner / spreads

Modular workflow assistant for book digitization
GNU Affero General Public License v3.0
127 stars 53 forks source link

Spreads crashes with "module 'chdkptp' not found" error (with chdkptp.py installed) #229

Closed yurkobb closed 8 years ago

yurkobb commented 8 years ago

I've installed spreads in a virtualenv using the instructions in README (with the exception of installing spreads itself from this git repo using python setup.py install). The system is xubuntu 16.04. Pip reports chdkptp.py installed fine. When running spread configure and selecting chdkcamera as the camera driver I get the following output and a crash:

(scanner-software) wikimediaua@wmua-scanner:~/scanner-software/spreads$ spread configure
Please select a device driver from the following list:
  [0]: Keep current (None)
  [1]: gphoto2camera
  [2]: chdkcamera
  [3]: dummy
  [4]: None
Select a driver: 2
Selected "chdkcamera" as device driver
spreads encountered an error:
Traceback (most recent call last):
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/spreads-0.5git20160705.5075-py2.7.egg/spreads/main.py", line 321, in main
    run()
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/spreads-0.5git20160705.5075-py2.7.egg/spreads/main.py", line 308, in run
    args.subcommand(config)
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/spreads-0.5git20160705.5075-py2.7.egg/spreads/cli.py", line 203, in configure
    driver = plugin.get_driver(config["driver"].get())
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/spreads-0.5git20160705.5075-py2.7.egg/spreads/plugin.py", line 453, in get_driver
    return ext.load()
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/spreads-0.5git20160705.5075-py2.7.egg/spreadsplug/dev/chdkcamera.py", line 8, in <module>
    import chdkptp
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/__init__.py", line 1, in <module>
    from chdkptp.device import ChdkDevice, list_devices, DeviceInfo
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/device.py", line 8, in <module>
    from chdkptp.lua import LuaContext, PTPError, global_lua, parse_table
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/lua.py", line 136, in <module>
    global_lua = LuaContext()
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/lua.py", line 87, in __init__
    self._setup_runtime()
  File "/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/lua.py", line 108, in _setup_runtime
    """.format(CHDKPTP_PATH))
  File "lupa/_lupa.pyx", line 259, in lupa._lupa.LuaRuntime.execute (lupa/_lupa.c:4892)
  File "lupa/_lupa.pyx", line 1254, in lupa._lupa.run_lua (lupa/_lupa.c:18430)
  File "lupa/_lupa.pyx", line 1263, in lupa._lupa.call_lua (lupa/_lupa.c:18579)
  File "lupa/_lupa.pyx", line 1272, in lupa._lupa.execute_lua_call (lupa/_lupa.c:18689)
  File "lupa/_lupa.pyx", line 1225, in lupa._lupa.raise_lua_error (lupa/_lupa.c:17999)
LuaError: [string "<python>"]:2: module 'chdkptp' not found:
    no field package.preload['chdkptp']
    no file '/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/vendor/chdkptp/lua/chdkptp.lua'
    no file '/usr/local/share/lua/5.2/chdkptp.lua'
    no file '/usr/local/share/lua/5.2/chdkptp/init.lua'
    no file '/usr/local/lib/lua/5.2/chdkptp.lua'
    no file '/usr/local/lib/lua/5.2/chdkptp/init.lua'
    no file '/usr/share/lua/5.2/chdkptp.lua'
    no file '/usr/share/lua/5.2/chdkptp/init.lua'
    no file './chdkptp.lua'
    no file '/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/vendor/chdkptp/chdkptp.so'
    no file '/home/wikimediaua/scanner-software/local/lib/python2.7/site-packages/chdkptp/vendor/chdkptp/lua/chdkptp.lua'
    no file '/usr/local/share/lua/5.2/chdkptp.lua'
    no file '/usr/local/share/lua/5.2/chdkptp/init.lua'
    no file '/usr/local/lib/lua/5.2/chdkptp.lua'
    no file '/usr/local/lib/lua/5.2/chdkptp/init.lua'
    no file '/usr/share/lua/5.2/chdkptp.lua'
    no file '/usr/share/lua/5.2/chdkptp/init.lua'
    no file './chdkptp.lua'

pip freeze reports:

backports-abc==0.4
backports.ssl-match-hostname==3.5.0.1
blinker==1.4
certifi==2016.2.28
cffi==1.5.2
chdkptp.py==0.1.3
click==6.6
colorama==0.3.7
defusedxml==0.4.1
enum34==1.1.6
Flask==0.11.1
futures==3.0.5
isbnlib==3.6.1
itsdangerous==0.24
Jinja2==2.8
jpegtran-cffi==0.5.2
lupa==1.3
Magic-file-extensions==0.2
MarkupSafe==0.23
pathlib==1.0.1
pkg-resources==0.0.0
ply==3.7
psutil==4.3.0
pycparser==2.14
pyliblzma==0.5.3
PyYAML==3.11
requests==2.10.0
roman==2.0.0
singledispatch==3.4.0.3
six==1.10.0
SOAPpy==0.12.22
spreads===0.5git20160705.5075
tornado==4.3
virtualenv==15.0.1
Wand==0.4.3
Werkzeug==0.11.10
wstools==0.4.3
zipstream==1.1.4

Is something wrong with the chdkptp.py installation?

jbaiter commented 8 years ago

Looks like it cannot find the native library for chdkptp. Can you please uninstall chdkptp.py with pip uninstall chdkptp.py? Then Then, follow the instructions here: https://github.com/jbaiter/chdkptp.py#requirements and install chdkptp.py with this command:

pip install --no-cache-dir --verbose chdkptp.py

If you see a flurry of gcc lines in the output, you're probably good! The --no-cache-dir is neccessary for the case where Pip caches the package in your home directory, we don't want that since we need to re-build it.

yurkobb commented 8 years ago

@jbaiter, thank you for your quick reply. Reinstalling chdkptp.py as you suggested eliminated the crash. The liblua5.2-dev was already installed. Unfortunately I didn't keep the log when I initially installed it to debug what was the cause. Thank you!

jbaiter commented 8 years ago

I think it was just the extra flag that needs to be passed during the lupa installation. Unfortunately I don't know of a way to set this in the library's setup.py to apply it automatically :/