On Tuesday, April 24, 2018 at 2:20:39 AM UTC-7, Martin R wrote: > > Here goes the new minimal non working example. > > (I would use setup.py, if I knew how and if I knew that it would cure this > problem) > > Thanks for any help! > > Martin > > > ######## minimal.py ############ > import sage.all > import pyximport; pyximport.install(); > from minimal_pyx import minimal_fun > > print(minimal_fun()) > ######## end minimal.py ############ > > ######## minimal_pyx.pyx ############ > from sage.all import * > > def minimal_fun(): > A = AlternatingSignMatrix([ [0,1,0], [1,-1,1],[0,1,0]]) > return str(map(list, A.to_matrix())) > > ######## end minimal_pyx.pyx ############ > ImportError: Building module sage.modules.vector_real_double_dense failed: > ["CompileError: command 'gcc' failed with exit status 1\n"] > > The joys of run time imports. I don't think this is the game of whack-a-mole you want to play. Obviously, sage imports are generally *NOT* suitable to be executed with the pyximport hook active. So, you have to make sure all the imports you need are done *before* you install the hook. "sage.all" takes care of a lot, but there are plenty of imports in sage that are done only when they are needed (to save start-up time in general). I wonder how bad things crash when you start using symbolics.
In this case, you can just work your way down the failures. It looks to me like ### import sage.all import sage.modules.vector_real_double_dense import sage.modules.vector_complex_double_dense import pyximport; pyximport.install(); from minimal_pyx import minimal_fun print(minimal_fun()) ### works, but I don't see a way of predicting beforehand what imports you need. It may still be that a mild redesign of the sage build process might make it suitable for pyximport, or alternatively that with some extra customization pyximport can be made to work in a sage environment. However, it looks to me it's trying to compile *way* too much. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.