Ask Your Question

%cython in notebook doesn’t work anymore

asked 2014-11-16 18:49:45 +0200

Fabrice gravatar image

updated 2015-01-13 20:51:43 +0200

FrédéricC gravatar image

running on macosx 10.9.5, i can’t use %cython in the notebook anymore (it used to work some time ago though, with older sage and system versions);
i get the following: error: command 'gcc' failed with exit status 1
more precisely, gcc doesn’t find a certain file limits.h (see details below) that, however, exists at the given address - i checked it;
how can i make it work again?

PS: same gcc error when loading a .spyx file in the command line
PS2: same errors with the 6.4 version (sage-6.4-x86_64-Darwin-OSX_10.9_x86_64.dmg)

gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/ -I/Applications/ -I/Applications/ -I/Applications/ -I/Applications/ -I/Applications/ -I/Applications/ -I/Users/fabrice/.sage/sage_notebook.sagenb/home/admin/123/code -I/Applications/ -c _Users_fabrice__sage_sage_notebook_sagenb_home_admin_123_code_sage2_spyx_0.c -o build/temp.macosx-10.9-x86_64-2.7/_Users_fabrice__sage_sage_notebook_sagenb_home_admin_123_code_sage2_spyx_0.o -w -O2
In file included from /Applications/,
                 from /Applications/,
                 from /Applications/,
                 from _Users_fabrice__sage_sage_notebook_sagenb_home_admin_123_code_sage2_spyx_0.c:16:
/Applications/ fatal error: limits.h: No such file or directory
compilation terminated.
edit retag flag offensive close merge delete


Does it work in the command line? (I mean does Cython at all work?) Since you have 6.3, should not be relevant to you. It's also possible that there is some incompleteness from the compiled binary to your specific platform.

kcrisman gravatar imagekcrisman ( 2014-11-17 16:27:33 +0200 )edit

In the command line, i can load a .sage file but not a .spyx file, for the very same reason as above (same gcc failed error message)

Fabrice gravatar imageFabrice ( 2014-11-20 12:58:50 +0200 )edit

3 Answers

Sort by » oldest newest most voted

answered 2014-11-20 14:28:06 +0200

kcrisman gravatar image

Okay, so there is something wrong with your Sage, not the notebook per se. You could download a more recent Sage, compile from scratch, or even try to recompile the Sage in your app (it turns out you can swap out different Sage versions in the app, in fact there is even a preferences item for this). I'm not sure of the exact cause, however, if that file really does exist.

edit flag offensive delete link more


thanks for the answer kcrisman;

i just downloaded the 6.4 version (not the .app this time, in order to eliminate a doubt); exactly the same problem, both with the notebook and the command line;

recompiling sage? i fear i'll have some problems with xcode anyway... but i'll try;

now, with which compiler? any gcc would do the job?

ps: useless to say i'd prefer it would work directly from the downloaded binaries! :))

Fabrice gravatar imageFabrice ( 2014-11-20 15:25:45 +0200 )edit

answered 2014-11-21 18:11:36 +0200

Fabrice gravatar image

How the problem was fixed (magic algorithm):

  • i installed the command line tools of xcode (seemingly not included under osx 10.9)
  • started to compile sage-6.4 from source
  • stopped the compilation after around 1h and deleted the whole sage-6.4 folder

    After that, recovered its usual %cython behavior in the notebook.

    Could be that only the first step was useful, but no way checking it now.

  • edit flag offensive delete link more

    answered 2014-11-20 16:35:04 +0200

    slelievre gravatar image

    Under Mac OS X 10.8, you should use the binaries for OS X 10.7 rather than those for OS X 10.9.

    If you want to build from source, I would recommend to:

    • apply system updates to run the latest version of OS X 10.8,
    • update XCode to the latest version compatible with OS X 10.8,
    • install command-line tools,
    • start XCode once and quit it.

    Then you can build from source and all should go well. If there are any problems, report them here or on sage-release.

    edit flag offensive delete link more


    thanks, and right: so sorry, i run 10.9 not 8 (updated the question); with the 6.1 version of xcode;

    half good news:

    • i started to build sage 6.4 from source but had to interrupt the compilation - so i trashed the 6.4 folder before leaving here; just in case, i tried now it works fine, %cython in notebook has its usual behavior (isn't that magic?)

    • now i have to find some log of the interrupted make (if any) in order to see what could have changed, i guess this might be a compiler problem

    to be followed

    Fabrice gravatar imageFabrice ( 2014-11-20 17:57:17 +0200 )edit

    the original log is lost; all i can say is what happened between the dates " doesn't run cython" and " does run cython":

  • i installed the command line tools of xcode (seemingly not included under osx 10.9)
  • started to compile sage-6.4 from source
  • stopped the compilation after around 1h and deleted the whole sage-6.4 folder

    this doesn't help me to figure out what the bug is, only greatly restricts the possibilities; thanks for your help!

  • Fabrice gravatar imageFabrice ( 2014-11-21 18:03:34 +0200 )edit

    I'm pretty sure it was installing Xcode that solved it, because probably now somewhere in your path there were appropriate headers etc. Cython won't work on a binary, probably, without a compiler, I seem to remember a ticket about making that more obvious - even if gcc is installed in Sage I'm not sure it's easy to use it properly in a binary. Wish I could remember more offhand.

    kcrisman gravatar imagekcrisman ( 2014-11-23 03:38:46 +0200 )edit

    Your Answer

    Please start posting anonymously - your entry will be published after you log in or create a new account.

    Add Answer

    Question Tools

    1 follower


    Asked: 2014-11-16 18:49:45 +0200

    Seen: 821 times

    Last updated: Nov 21 '14