[PyQt] Trouble using pyqtdeploy wuth SciPy's cythonized modules

Robert Kent rob at gulon.co.uk
Thu Feb 4 12:36:21 GMT 2016


Hi All,

I'm using pyqtdeploy 1.2 on OSX to package my application and so far 
have succeeded in getting NumPy and matplotlib to build. I (and Google!) 
came up with a method for including modules built as static objects 
(.so) by adding them to the Resources directory of the app bundle and 
then adding a hook via sys.meta_path to allow them to be imported 
outwith the resource system. To clarify, this means that anything that 
is a .py file is built into the application via the Qt resource system 
and anything that is an .so file is packaged separately. This has worked 
fine until I tried it with SciPy and it's cythonized .so files which 
throw a SystemError on import as follows:

...
File ":/scipy/optimize/__init__.py", line 233, in <module>
   File "bootstrap.py", line 2237, in _find_and_load
   File "bootstrap.py", line 2226, in _find_and_load_unlocked
   File "bootstrap.py", line 1191, in _load_unlocked
   File "bootstrap.py", line 1161, in _load_backward_compatible
   File ":/scipy/optimize/_minimize.py", line 26, in <module>
   File "bootstrap.py", line 2237, in _find_and_load
   File "bootstrap.py", line 2226, in _find_and_load_unlocked
   File "bootstrap.py", line 1191, in _load_unlocked
   File "bootstrap.py", line 1161, in _load_backward_compatible
   File ":/scipy/optimize/_trustregion_dogleg.py", line 5, in <module>
   File "bootstrap.py", line 2237, in _find_and_load
   File "bootstrap.py", line 2226, in _find_and_load_unlocked
   File "bootstrap.py", line 1191, in _load_unlocked
   File "bootstrap.py", line 1161, in _load_backward_compatible
   File ":/scipy/linalg/__init__.py", line 175, in <module>
   File "bootstrap.py", line 2237, in _find_and_load
   File "bootstrap.py", line 2226, in _find_and_load_unlocked
   File "bootstrap.py", line 1191, in _load_unlocked
   File "bootstrap.py", line 1161, in _load_backward_compatible
   File ":/scipy/linalg/basic.py", line 21, in <module>
   File "bootstrap.py", line 2237, in _find_and_load
   File "bootstrap.py", line 2226, in _find_and_load_unlocked
   File "bootstrap.py", line 1191, in _load_unlocked
   File "bootstrap.py", line 1161, in _load_backward_compatible
   File "__main__.py", line 30, in load_module
   File ":/imp.py", line 243, in load_module
   File "scipy/linalg/_solve_toeplitz.pyx", line 4, in init 
scipy.linalg._solve_toeplitz (scipy/linalg/_solve_toeplitz.c:19797)
SystemError: Parent module '' not loaded, cannot perform relative import

The whole 'relative import' bit seems to be a red herring as what its 
actually trying to do at that point is import bits of numpy. I'm 
guessing this is to do with me moving these .so files outside of the 
normal import tree so it cant find things...

I'm just wondering if Phil or anybody else has had success in including 
either SciPy or any other cythonized modules in a pyqtdeploy project 
and, if so, how?

Thanks very much,
Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160204/ea8c5371/attachment.html>


More information about the PyQt mailing list