Sligh(?) problem with sage_mode

54 views
Skip to first unread message

Emmanuel Charpentier

unread,
Jun 19, 2013, 9:50:48 AM6/19/13
to sage-s...@googlegroups.com
Dear list,

I quite recently installed sage_mode 0.9.1 on my installation of sage 5.9 (patched with a newer R version) on Debian jessie.

The firs try is a charm : output gets typeset in emacs (emacs24), plots are plotted (a bit too wide and way too tall for an 80x24 frame, but that's not my point). Joy.

The second time, nothing works  : emacs waits forever for a sage process whose python is gone zombie (ps axf dixit). I have to kill -TERM it.

Various attempts are inefficient until, SOL, I move away my .sage directory : lo ! Emacs works again (one time...) and sage ditto. But, of course, this creates a new .sage directiory, which has exactly the same problems. Aaaarghhh...

Any hint ?

setup

Emmanuel Charpentier

unread,
Jun 19, 2013, 1:10:34 PM6/19/13
to sage-s...@googlegroups.com
A precision : "The first time" meants "th first emacs session" : at the first invpcatio of emacs, you can quit a sage session, kill the corresponding buffer and re-launch sage in emacs at will : it will work. But if you leave emacs and lauch it again, you will get a dead sage and a waiting-forever emacs.

                                                                                Emmanuel Charpentier

Ivan Andrus

unread,
Jun 19, 2013, 9:05:21 PM6/19/13
to sage-s...@googlegroups.com
Emmanuel,

That seems really weird.  

Did previous versions of sage and/or sage-mode work?  
Can you start sage from the command line after it doesn't work from Emacs?  
How are you launching Emacs, from within Sage perhaps?  
Do you exit Sage before exiting Emacs?  
Do you do anything else "unusual"?  
What does your .emacs contain (especially sage related)?

The best would be if you could give a minimal recipe starting from `emacs -Q`.

-Ivan

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Emmanuel Charpentier

unread,
Jun 20, 2013, 10:32:55 AM6/20/13
to sage-s...@googlegroups.com


Le jeudi 20 juin 2013 03:05:21 UTC+2, Ivan Andrus a écrit :
Emmanuel,

That seems really weird.  
 
Indeed :-) It is even more weird than that : see after the answers to your questions...
 
Did previous versions of sage and/or sage-mode work?  

Dunno : I started to switch to sage (from maxima) about 6 months ago, and I started with the notebook (which has its points for learning re: online documentation). Since I am a very *light* user of sage (my main profession has little to do with pure math, and my original profession absolutely none (even if we also work on hard roots:-)). I was veru fond of the imaxima mode, and wanted to emulate this behaviour with sage.
 
Can you start sage from the command line after it doesn't work from Emacs?  

Yes. Never was a problem
 
How are you launching Emacs, from within Sage perhaps?  

Nope, the reverse : either "emacs -f sage" from the command line or M-x sage from within emacs. The habit came to me by way of R and ESS...
 
Do you exit Sage before exiting Emacs?  

Yes.
 
Do you do anything else "unusual"?  

Most of my professional entourage find unusual (to say the least) to need any form of symbolic math software... :-).
 
What does your .emacs contain (especially sage related)?

See enclosed copy
 
The best would be if you could give a minimal recipe starting from `emacs -Q`.

Won't do any good to you : my "(require sage "sage") is in my .emacs, which won't get searchde when starting emacs with -Q flag.

The simplest way : start emacs from command line or from a gnome icon, type "M-x sage" in the startum screen, and voilà : first time it works like a charm, second time (= second emacs invocation) : a dead emacs.

Now for the weirder part : I observed this behaviour on two machines : a "normal" desktop ang a large desktop used as a server. On a third machine (a small notebook I bring with me almost everywhere), things work as advertised. I can't for the life of me state what differs between these machines re: sage and/or emacs. All of theme also have texlive, R and maxima installations, all of them run Debian testing (updated often).

Heisenbug ?

Sincerely,

                                                                                                            Emmanuel Charpentier
.emacs

Ivan Andrus

unread,
Jun 20, 2013, 2:44:08 PM6/20/13
to sage-s...@googlegroups.com, Emmanuel Charpentier
On Jun 20, 2013, at 8:32 AM, Emmanuel Charpentier <emanuel.c...@gmail.com> wrote:

Le jeudi 20 juin 2013 03:05:21 UTC+2, Ivan Andrus a écrit :
Emmanuel,

That seems really weird.  
 
Indeed :-) It is even more weird than that : see after the answers to your questions…

:-)

Did previous versions of sage and/or sage-mode work?  

Dunno : I started to switch to sage (from maxima) about 6 months ago, and I started with the notebook (which has its points for learning re: online documentation). Since I am a very *light* user of sage (my main profession has little to do with pure math, and my original profession absolutely none (even if we also work on hard roots:-)). I was veru fond of the imaxima mode, and wanted to emulate this behaviour with sage.

Fair enough.

Can you start sage from the command line after it doesn't work from Emacs?  

Yes. Never was a problem

Curiouser and curiouser.

How are you launching Emacs, from within Sage perhaps?  

Nope, the reverse : either "emacs -f sage" from the command line or M-x sage from within emacs. The habit came to me by way of R and ESS...

Do you exit Sage before exiting Emacs?  

Yes.
 
Do you do anything else "unusual"?  

Most of my professional entourage find unusual (to say the least) to need any form of symbolic math software... :-).

:-)  Good job.

What does your .emacs contain (especially sage related)?

See enclosed copy

It's pretty simple and I don't see anything that I think would cause the problem...

The best would be if you could give a minimal recipe starting from `emacs -Q`.

Won't do any good to you : my "(require sage "sage") is in my .emacs, which won't get searchde when starting emacs with -Q flag.

What I meant was something like

$ emacs -Q

;; Evaluate in scratch:
(add-to-list 'load-path "/usr/local/sage/local/share/emacs")
(require 'sage "sage")
(setq sage-command "/usr/local/bin/sage")
(require 'sage-view "sage-view")
(add-hook 'sage-startup-after-prompt-hook 'sage-view)

M-x sage RET

C-x C-c

Repeat.  

Is that enough to reproduce it?  That eliminates other problems in your .emacs file, though I don't think that's very likely the problem.  I think it has to be something in .sage, but I've been wrong before. :-)

The simplest way : start emacs from command line or from a gnome icon, type "M-x sage" in the startum screen, and voilà : first time it works like a charm, second time (= second emacs invocation) : a dead emacs.

What happens if you turn on debugging (M-x toggle-debug-on-quit RET) and then run M-x sage and press C-g when it's frozen?

Now for the weirder part : I observed this behaviour on two machines : a "normal" desktop and a large desktop used as a server. On a third machine (a small notebook I bring with me almost everywhere), things work as advertised. I can't for the life of me state what differs between these machines re: sage and/or emacs. All of them also have texlive, R and maxima installations, all of them run Debian testing (updated often).

Is there any way I could get a temporary account on the server to see if I can debug it there?  Email me privately with username and password if so.

Do they all have the same versions of Emacs, Sage, and same configuration files?  Perhaps .bashrc could come into play as well by setting the environment variable RANDOM_BUGS=1 :-)

Heisenbug ?

Well, I've certainly never seen it, but there's probably a good reason for it.

Sincerely,

                                                                                                            Emmanuel Charpentier

-Ivan

 
-Ivan

On Jun 19, 2013, at 11:10 AM, Emmanuel Charpentier <emanuel.c...@gmail.com> wrote:

A precision : "The first time" meants "th first emacs session" : at the first invpcatio of emacs, you can quit a sage session, kill the corresponding buffer and re-launch sage in emacs at will : it will work. But if you leave emacs and lauch it again, you will get a dead sage and a waiting-forever emacs.

                                                                                Emmanuel Charpentier


Le mercredi 19 juin 2013 15:50:48 UTC+2, Emmanuel Charpentier a écrit :
Dear list,

I quite recently installed sage_mode 0.9.1 on my installation of sage 5.9 (patched with a newer R version) on Debian jessie.

The firs try is a charm : output gets typeset in emacs (emacs24), plots are plotted (a bit too wide and way too tall for an 80x24 frame, but that's not my point). Joy.

The second time, nothing works  : emacs waits forever for a sage process whose python is gone zombie (ps axf dixit). I have to kill -TERM it.

Various attempts are inefficient until, SOL, I move away my .sage directory : lo ! Emacs works again (one time...) and sage ditto. But, of course, this creates a new .sage directiory, which has exactly the same problems. Aaaarghhh...

Any hint ?

setup

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
<.emacs>

Emmanuel Charpentier

unread,
Jun 20, 2013, 4:14:07 PM6/20/13
to sage-s...@googlegroups.com, Emmanuel Charpentier
Dear Ivan,

It gets even weirder (it begins to look as the start of a summertime thriller). *Before* seeing your last reply, I saw that sage 5.10 was out and installed it on my "big desktop" machine (compilation from sources, installation of the new R spkg and related patch, installation of database_gap 4.5.7 as recommended by the readme, and of dot2tex and sage_mode).

This time, even after suppression of the .sage directory, it doesn't even work : M-x sage succeeds, giving me a prompt ; but typesetting doesn't work. Asking for 2+2 gives me :
Typesetting \newcommand{\Bold}[1]{\mathbf{#1}}4...
[ BTW : I had to type this in this mail ; copy-and-paste from the emacs wondow gives this :
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}4</script></html>
]
in the *SAGE-main* buffer and the following messages in the *Messages* buffer :
Creation of `/home/charpent/.sage/tmp/emacs20421oDo' failed: Creating directory: aucun fichier ou dossier de ce type, /home/charpent/.sage/tmp/emacs20421oDo
error in process filter: sage-view-process-overlay: Opening output file: aucun fichier ou dossier de ce type, /home/charpent/.sage/tmp/emacs20421oDo/sage-view_20421bAW.tex
error in process filter: Opening output file: aucun fichier ou dossier de ce type, /home/charpent/.sage/tmp/emacs20421oDo/sage-view_20421bAW.tex

Now for your questions : I cannot access tonight my "small desktop" machine, which still has 5.9 and exhibits the original problem : it will have to wait for tomorrow afternoon... Stay tuned !

Thank you very much for your attention,

                                                                  Emmanuel Charpentier

Ivan Andrus

unread,
Jun 20, 2013, 5:02:35 PM6/20/13
to sage-s...@googlegroups.com, Emmanuel Charpentier
On Jun 20, 2013, at 2:14 PM, Emmanuel Charpentier <emanuel.c...@gmail.com> wrote:

Dear Ivan,

It gets even weirder (it begins to look as the start of a summertime thriller). *Before* seeing your last reply, I saw that sage 5.10 was out and installed it on my "big desktop" machine (compilation from sources, installation of the new R spkg and related patch, installation of database_gap 4.5.7 as recommended by the readme, and of dot2tex and sage_mode).

This time, even after suppression of the .sage directory, it doesn't even work : M-x sage succeeds, giving me a prompt ; but typesetting doesn't work. Asking for 2+2 gives me :
Typesetting \newcommand{\Bold}[1]{\mathbf{#1}}4...
[ BTW : I had to type this in this mail ; copy-and-paste from the emacs wondow gives this :
<html><script type="math/tex">\newcommand{\Bold}[1]{\mathbf{#1}}4</script></html>
]
in the *SAGE-main* buffer and the following messages in the *Messages* buffer :
Creation of `/home/charpent/.sage/tmp/emacs20421oDo' failed: Creating directory: aucun fichier ou dossier de ce type, /home/charpent/.sage/tmp/emacs20421oDo
error in process filter: sage-view-process-overlay: Opening output file: aucun fichier ou dossier de ce type, /home/charpent/.sage/tmp/emacs20421oDo/sage-view_20421bAW.tex
error in process filter: Opening output file: aucun fichier ou dossier de ce type, /home/charpent/.sage/tmp/emacs20421oDo/sage-view_20421bAW.tex

I can confirm this problem in the absence of a .sage directory.  I have a fix for it, but in the mean time a simple

$ mkdir -p /Users/ivanandres/.sage/tmp/

before starting Emacs should fix it.

Now for your questions : I cannot access tonight my "small desktop" machine, which still has 5.9 and exhibits the original problem : it will have to wait for tomorrow afternoon... Stay tuned !

Thanks,
Ivan

Emmanuel Charpentier

unread,
Jun 21, 2013, 10:17:58 AM6/21/13
to sage-s...@googlegroups.com, Emmanuel Charpentier
Dear Ivan,

Followup to yor unanswered questions of yesterday :

[ Snip... ]

The best would be if you could give a minimal recipe starting from `emacs -Q`.

Won't do any good to you : my "(require sage "sage") is in my .emacs, which won't get searchde when starting emacs with -Q flag.

What I meant was something like

$ emacs -Q

;; Evaluate in scratch:
(add-to-list 'load-path "/usr/local/sage/local/share/emacs")
(require 'sage "sage")
(setq sage-command "/usr/local/bin/sage")
(require 'sage-view "sage-view")
(add-hook 'sage-startup-after-prompt-hook 'sage-view)

M-x sage RET

C-x C-c

Repeat.  

Is that enough to reproduce it?  That eliminates other problems in your .emacs file, though I don't think that's very likely the problem.  I think it has to be something in .sage, but I've been wrong before. :-)
Same result as before : first time (after removing ~/.sage), wiorks like a charm, second time : dead emacs.
 
The simplest way : start emacs from command line or from a gnome icon, type "M-x sage" in the startum screen, and voilà : first time it works like a charm, second time (= second emacs invocation) : a dead emacs.

What happens if you turn on debugging (M-x toggle-debug-on-quit RET) and then run M-x sage and press C-g when it's frozen?

Aha ! When, I press ^G, the frame gets divided in two windows : *SAGE-newerr* and *Backtrace*.
Content off *SAGE-newerr* :
Debugger entered--Lisp error: (quit)
  python-send-string("%colors NoColor")
  sage-send-command("%colors NoColor" nil)
  sage-send-startup-before-prompt-command()
  run-hooks(sage-startup-before-prompt-hook)
  sage(nil)
  call-interactively(sage record nil)
  command-execute(sage record)
  execute-extended-command(nil "sage")
  call-interactively(execute-extended-command nil nil)

Content of *Backtrace* :
----------------------------------------------------------------------
| Sage Version 5.9, Release Date: 2013-04-30                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
  RET
KeyboardInterrupt
sage: 

Quite interestingly, sage is still active, and answers to command, but output is not typeset :
sage: 2+2
4
sage: integrate(tan(x), x)
log(sec(x))
sage: 

quitting sage then C-x C-c does a "normal" emacs exit (no hangup). Repeating leads to the same result.

I tried to disable online typesetting and online plot in the .emacs file : I still get a dead emacs when requesting a sage session...
Now for the weirder part : I observed this behaviour on two machines : a "normal" desktop and a large desktop used as a server. On a third machine (a small notebook I bring with me almost everywhere), things work as advertised. I can't for the life of me state what differs between these machines re: sage and/or emacs. All of them also have texlive, R and maxima installations, all of them run Debian testing (updated often).

Is there any way I could get a temporary account on the server to see if I can debug it there?  Email me privately with username and password if so.

OK : what is your mail address ?  Mail me at emanuel period charpentier hat gmail.com
 
Do they all have the same versions of Emacs, Sage, and same configuration files?  Perhaps .bashrc could come into play as well by setting the environment variable RANDOM_BUGS=1 :-)

Currently : "big desktop" : sage 5.10, "small desktop" and "notebook" : sage 5.9. In all three cases, I updated R to 3.0.1 (see TRAC#14706) and installed database_gap_4.5.7, dot2tex and sage_mode_0.9.1. All of them are running Debian jessie, updatete about daily. The relevant .bashrc are about pristine. "Big_desktop" has a sage-5.10 directory belonging to user "sage", symlinked to /usr/local/sage. "Small desktop" has a /usr/local/sage-5.9 directory belonging to me, symlinked as /usr/local/sage. "notebook" has a sage5-9 directory in my home directory, symlinked as /usr/local/sage. In all cases, /usr/local/bn/sage is a symlink to /usr/local/sage/sage.
 

Heisenbug ?

Well, I've certainly never seen it, but there's probably a good reason for it.

Schrödinbug ?? 

Again, thank you for your time and your help !

                                                                                                  Emmanuel Charpentier

Ivan Andrus

unread,
Jun 21, 2013, 11:22:21 AM6/21/13
to sage-s...@googlegroups.com
On Jun 21, 2013, at 8:17 AM, Emmanuel Charpentier <emanuel.c...@gmail.com> wrote:

Dear Ivan,

Followup to yor unanswered questions of yesterday :

[ Snip... ]
 
The simplest way : start emacs from command line or from a gnome icon, type "M-x sage" in the startum screen, and voilà : first time it works like a charm, second time (= second emacs invocation) : a dead emacs.

What happens if you turn on debugging (M-x toggle-debug-on-quit RET) and then run M-x sage and press C-g when it's frozen?

Aha ! When, I press ^G, the frame gets divided in two windows : *SAGE-newerr* and *Backtrace*.
Content off *SAGE-newerr* :
Debugger entered--Lisp error: (quit)
  python-send-string("%colors NoColor")
  sage-send-command("%colors NoColor" nil)
  sage-send-startup-before-prompt-command()
  run-hooks(sage-startup-before-prompt-hook)
  sage(nil)
  call-interactively(sage record nil)
  command-execute(sage record)
  execute-extended-command(nil "sage")
  call-interactively(execute-extended-command nil nil)

Content of *Backtrace* :
----------------------------------------------------------------------
| Sage Version 5.9, Release Date: 2013-04-30                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
  RET
KeyboardInterrupt
sage: 

I thought it might be something like this.  Now if I just knew what caused it. :-)

Quite interestingly, sage is still active, and answers to command, but output is not typeset :
sage: 2+2
4
sage: integrate(tan(x), x)
log(sec(x))
sage: 

That's because sage-view isn't turned on until after all the initialization happens and you quit before then.   You should be able to turn sage-view on manually via M-x sage-view.

quitting sage then C-x C-c does a "normal" emacs exit (no hangup). Repeating leads to the same result.

-Ivan

Reply all
Reply to author
Forward
0 new messages