cython magic fail if cache dir is deleted while in session #3010

Closed
juliantaylor opened this Issue Mar 10, 2013 · 3 comments

Comments

Projects
None yet
2 participants
In [1]: %load_ext cythonmagic

In [2]: %%cython
cimport cython
   ...: 

In [3]: rm -rf /home/jtaylor/.config/ipython/cython/

In [4]: %%cython                                    
cimport cython

CompileError: command 'x86_64-linux-gnu-gcc' failed with exit status 1

the command issued is:

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -c /home/jtaylor/.config/ipython/cython/_cython_magic_d37c0b24f28dfb69270e82105a4c2e8e.c -o /home/jtaylor/.config/ipython/cython/home/jtaylor/.config/ipython/cython/_cython_magic_d37c0b24f28dfb69270e82105a4c2e8e.o
Fatal error: can't create /home/jtaylor/.config/ipython/cython/home/jtaylor/.config/ipython/cython/_cython_magic_d37c0b24f28dfb69270e82105a4c2e8e.o: No such file or directory

the problematic part is this long path which is not recreated before trying to compile into it:

/home/jtaylor/.config/ipython/cython/home/jtaylor/.config/ipython/cython/
Owner

minrk commented Jul 4, 2013

closed by e945888

minrk closed this Jul 4, 2013

I can still reproduce it with current git head, note that with that commit you have to delete ~/.cache/ipython/cython/

juliantaylor reopened this Jul 4, 2013

Owner

minrk commented Jul 4, 2013

Gotcha, I must have done something wrong in testing. Thanks for checking.

I tracked this down to a bug in distutils, where its mkpath utility will only ever create a particular path once,
and assume that it still exists forever after for the lifetime of the process. I can make a workaround, but it might be gross.

@minrk minrk added a commit to minrk/ipython that referenced this issue Jul 4, 2013

@minrk minrk allow cython cache dir to be deleted
workaround by clearing the distutils mkpath cache,
which prevents it from ever creating a given path more than once.

closes #3010
10d191b

Carreau closed this in #3540 Jul 6, 2013

@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

@minrk minrk allow cython cache dir to be deleted
workaround by clearing the distutils mkpath cache,
which prevents it from ever creating a given path more than once.

closes #3010
ba5aab4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment