ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 22 Jul 2015 08:56:18 -0500Running octave from the sage notebookhttps://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:
RuntimeError: Unable to start octave
Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!Wed, 16 Feb 2011 07:40:16 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/Comment by gundamlh for <p>I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:</p>
<p>RuntimeError: Unable to start octave</p>
<p>Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=16699#post-id-16699That is cool, the syntax in OCTAVE is almost identical to MATLAB.. PS, can we use YALMIP under SAGE?Fri, 15 Nov 2013 00:31:01 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=16699#post-id-16699Answer by droppit for <p>I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:</p>
<p>RuntimeError: Unable to start octave</p>
<p>Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=14812#post-id-14812Similar to above, the following worked for me from the notebook interface of sage:
os.environ["PATH"]+=":/opt/local/bin"
Octave was installed on my system using MacPorts.
I found that `octave.eval('2+2')` worked immediately in the notebook, but `octave(2+2)`, required:
octave = Octave()
octave._start()
otherwise it errored with "ValueError: The octave session in which this object was defined is no
longer running."
Note: octave.eval returns a string, usually with "ans =", whereas octave() returns a number that I could perform further operations on.
You may want to put octave.quit(True) at the end. I don't understand what is actually going on well, so take my advice with caution.
see also: [http://www.sagemath.org/doc/reference/interfaces/sage/interfaces/octave.html](http://www.sagemath.org/doc/reference/interfaces/sage/interfaces/octave.html)Sat, 20 Apr 2013 13:02:56 -0500https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=14812#post-id-14812Answer by quantum7 for <p>I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:</p>
<p>RuntimeError: Unable to start octave</p>
<p>Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=28684#post-id-28684Although the question doesn't explicitly say so, I'm going to guess that the OP is running OSX (as assumed in other answers).
The fundamental problem here is that OSX applications don't read .bashrc or .profile like the shell does. There are several ways to modify the PATH variable for Mac Applications, as described on <a href="http://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications/51737#51737">this stack exchange question</a>. I used the wrapper-script answer by Rene to set my environment for Sage. It has the advantage of providing the same environment to Sage.app that you would expect at the command line, and it works across all notebooks (unlike above answers that modify PATH from within the notebook).
1. Create a file at /Applications/Sage-*version*.app/Contents/MacOS/Sage.sh with the following text:
> #!/bin/bash
> if [[ -x $HOME/.profile ]]; then
> source $HOME/.profile
> fi
> exec "`dirname \"$0\"`/Sage" "$@"
1. Make the file executable
> chmod +x /Applications/Sage-*.app/Contents/MacOS/Sage.sh
1. Edit /Applications/Sage-*version*.app/Contents/Info.plist. Change the `CFBundleExecutable` to point to the wrapper script
> <key>CFBundleExecutable</key>
> <string>Sage.sh</string>
1. Notify LaunchServices that the Info.plist has changed, either by restarting or by running
> /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/Sage-*.app
This solution will also address errors running other cell interpreters, such as the LaTeX 'PDFLaTeX does not seem to be installed' error.Wed, 22 Jul 2015 08:56:18 -0500https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=28684#post-id-28684Answer by kcrisman for <p>I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:</p>
<p>RuntimeError: Unable to start octave</p>
<p>Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=12112#post-id-12112Have you let Sage know where Octave is? That is, is Octave in your `PATH`? What I mean is whether you can just type `octave` to launch octave, or if you have to do something like `/path/to/octave/octave_executable` (the latter might not be visible to Sage). Otherwise I'm out of ideas, too.Wed, 16 Feb 2011 08:10:53 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=12112#post-id-12112Comment by Rick for <p>Have you let Sage know where Octave is? That is, is Octave in your <code>PATH</code>? What I mean is whether you can just type <code>octave</code> to launch octave, or if you have to do something like <code>/path/to/octave/octave_executable</code> (the latter might not be visible to Sage). Otherwise I'm out of ideas, too.</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=22109#post-id-22109Solved. See the answer below.Wed, 16 Feb 2011 09:24:00 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=22109#post-id-22109Comment by kcrisman for <p>Have you let Sage know where Octave is? That is, is Octave in your <code>PATH</code>? What I mean is whether you can just type <code>octave</code> to launch octave, or if you have to do something like <code>/path/to/octave/octave_executable</code> (the latter might not be visible to Sage). Otherwise I'm out of ideas, too.</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=22105#post-id-22105Great. Yeah, I'm not exactly sure what path Sage searches as opposed to one's standard path. Glad you could solve it!Wed, 16 Feb 2011 14:07:20 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=22105#post-id-22105Comment by Rick for <p>Have you let Sage know where Octave is? That is, is Octave in your <code>PATH</code>? What I mean is whether you can just type <code>octave</code> to launch octave, or if you have to do something like <code>/path/to/octave/octave_executable</code> (the latter might not be visible to Sage). Otherwise I'm out of ideas, too.</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=22111#post-id-22111I believe so. My .bashrc file extends the path to include /opt/local/bin/, which is where MacPorts installs octave. However, I don't know whether *sage* can find octave. Maybe I'll try to make a soft link to /usr/local/bin/ or /usr/bin/ or something.Wed, 16 Feb 2011 09:21:50 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=22111#post-id-22111Answer by Emmanuel Briand for <p>I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:</p>
<p>RuntimeError: Unable to start octave</p>
<p>Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=14641#post-id-14641I solved the same problem as follows: in the notebook I ran the SAGE command
os.environ["PATH"]+=": ... path to the binary for octave"
For instance
os.environ["PATH"]+=":/Applications/Octave.app/Contents/Resources/bin"
on my Mac with Octave.app.
This gives SAGE the information it needs to find octave.
Instead of writing this in the sage notebook every time you want to use octave, you may write it in your .sage/init.sage file.Thu, 14 Mar 2013 01:41:36 -0500https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=14641#post-id-14641Answer by Rick for <p>I'm trying to run octave through the sage notebook. When I try to evaluate a cell (e.g. x = linspace(0,1,100)), I get the error message:</p>
<p>RuntimeError: Unable to start octave</p>
<p>Examining the traceback in more detail doesn't point to anything that suggests how to fix the problem, and I was wondering whether anyone else had this problem. Octave is installed on my computer, and runs fine from the command line. Can anyone help me with this? Thanks in advance!</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=12114#post-id-12114As per kcrisman's answer above, I added a softlink from /opt/local/bin/octave to /usr/bin/octave, and now the sage server works. Similarly adding a link to /usr/local/bin/octave did not work.
Wed, 16 Feb 2011 09:25:04 -0600https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?answer=12114#post-id-12114Comment by ppurka for <p>As per kcrisman's answer above, I added a softlink from /opt/local/bin/octave to /usr/bin/octave, and now the sage server works. Similarly adding a link to /usr/local/bin/octave did not work.</p>
https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=18070#post-id-18070You don't have /usr/local/bin in your `PATH` - this is why the second one didn't work.Thu, 14 Mar 2013 06:31:44 -0500https://ask.sagemath.org/question/7949/running-octave-from-the-sage-notebook/?comment=18070#post-id-18070