You can use the Sage notebook separately from Sage.
It includes most of its dependencies. E.g., Ondrej Certik
ships the Sage Notebook with his FEMhub stuff, which
has none of Sage. I don't think the Sage notebook has
much more in dependencies than codenode.
William
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
How do I install it if I don't have sage installed?
> E.g., Ondrej Certik ships the Sage Notebook with his FEMhub stuff,
> which has none of Sage.
True, but, in fact, if I want to do anything it requires me to install
femhub (which for example includes fortran). Even in Ondreij's
femhub-lab there is still a lot of links to some sage code or femhub
code. Nobody hasn't yet told me how to hook in another backend.
"Look at the code" is not a very helpful hint.
> I don't think the Sage notebook has much more in dependencies than
> codenode.
Good. Then how would I install the Sage Notebook (just interested in a
bare minimum)?
And how would I, for example, make the notebook an interface to /bin/sh?
Ralf
Extract the tarball and do
source spkg-install
This will use whatever Python is in your PATH first.
>
>> E.g., Ondrej Certik ships the Sage Notebook with his FEMhub stuff,
>> which has none of Sage.
>
> True, but, in fact, if I want to do anything it requires me to install
> femhub (which for example includes fortran).
That was just an example to prove that the sage notebook does not
depend on sage.
> Even in Ondreij's
> femhub-lab there is still a lot of links to some sage code or femhub
> code.
Sage code? I doubt it.
> Nobody hasn't yet told me how to hook in another backend.
> "Look at the code" is not a very helpful hint.
It might be the only option for now... Hopefully that will change
though. It's good that you're asking good question, since they are
excellent motivation for writing better documentation.
>
>> I don't think the Sage notebook has much more in dependencies than
>> codenode.
>
> Good. Then how would I install the Sage Notebook (just interested in a
> bare minimum)?
> And how would I, for example, make the notebook an interface to /bin/sh?
>
> Ralf
>
--
Well, not to get the notebook running, but there is no clear API to how
to hook in anything else than sage or femhub.
Wouldn't that be the place where I should look for a hook?
>> Nobody hasn't yet told me how to hook in another backend.
>> "Look at the code" is not a very helpful hint.
> It might be the only option for now... Hopefully that will change
> though.
Is someone working on a better documentation right now?
> It's good that you're asking good question, since they are
> excellent motivation for writing better documentation.
Is there already someone who got motivated? ;-)
>> Good. Then how would I install the Sage Notebook (just interested in a
>> bare minimum)?
>> And how would I, for example, make the notebook an interface to /bin/sh?
OK, I did...
D=/home/hemmecke/scratch/sagenb
mkdir -p $D
cd $D
hg clone http://bitbucket.org/ianb/virtualenv
cd virtualenv
python virtualenv.py $D
export PATH=$D/bin:$PATH
cd $D
wget http://www.sagemath.org/packages/standard/sagenb-0.8.p2.spkg
bunzip2 -c sagenb-0.8.p2.spkg |tar xvf -
cd sagenb-0.8.p2
source spkg-install
cd $D
The script $D/sagenb-0.8.p2/src/sagenb/go obviously cannot work. It
starts with "#!/usr/bin/env pynb" and I have no pynb anywhere. So I did
it manually.
>python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sagenb.notebook.notebook_object as n
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/notebook_object.py",
line 17, in <module>
import notebook as _notebook
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/notebook.py",
line 40, in <module>
import js # javascript
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/js.py",
line 38, in <module>
from sage.misc.misc import SAGE_ROOT
ImportError: No module named sage.misc.misc
What am I doing wrong?
Ralf
sagenb-0.8.p2/src/sagenb/sagenb/notebook/js.py
says
try:
from sage.misc.misc import SAGE_ROOT
from pkg_resources import Requirement, working_set
sagenb_path = working_set.find(Requirement.parse('sagenb')).location
debug_mode = SAGE_ROOT not in os.path.realpath(sagenb_path)
except AttributeError, ImportError:
debug_mode = False
But according to what I cite below, it should rather be
except (AttributeError, ImportError):
Ralf
http://docs.python.org/tutorial/errors.html
A try statement may have more than one except clause, to specify
handlers for different exceptions. At most one handler will be executed.
Handlers only handle exceptions that occur in the corresponding try
clause, not in other handlers of the same try statement. An except
clause may name multiple exceptions as a parenthesized tuple, for example:
... except (RuntimeError, TypeError, NameError):
... pass
Now after correcting the bug, I get...
>python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sagenb.notebook.notebook_object as n
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/notebook_object.py",
line 17, in <module>
import notebook as _notebook
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/notebook.py",
line 41, in <module>
import worksheet # individual worksheets (which make up a notebook)
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/worksheet.py",
line 55, in <module>
import sagenb.misc.support as support
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/misc/support.py",
line 23, in <module>
import sageinspect
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/misc/sageinspect.py",
line 153, in <module>
SAGE_ROOT = os.environ["SAGE_ROOT"]
File "/home/hemmecke/scratch/sagenb/lib/python2.6/UserDict.py", line
22, in __getitem__
raise KeyError(key)
KeyError: 'SAGE_ROOT'
So in the hope that sage will not be required and that this is yet
another bug, I say
export SAGE_ROOT=$D
Maybe it would be a good idea to get rid of a SAGE_ROOT reference in the
notebook.
python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sagenb.notebook.notebook_object as n
>>> n.notebook('sage_notebook', server_pool=[])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/notebook_object.py",
line 217, in __call__
return self.notebook(*args, **kwds)
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/run_notebook.py",
line 174, in notebook_twisted
nb = notebook.load_notebook(directory)
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/notebook.py",
line 1715, in load_notebook
import sagenb.notebook.twist
File
"/home/hemmecke/scratch/sagenb/lib/python2.6/site-packages/sagenb-0.8-py2.6.egg/sagenb/notebook/twist.py",
line 42, in <module>
from twisted.web2 import server, http, resource, channel
ImportError: No module named web2
OK, let's install twistedweb2.
cd $D
svn co svn://svn.twistedmatrix.com/svn/Twisted/trunk twistedweb2
cd twistedweb2
python setup.py install
After that
python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sagenb.notebook.notebook_object as n
>>> n.notebook('sage_notebook', server_pool=[])
works and I can log into a notebook at http://localhost:8000/.
Fine.
So, please, could now someone point me to the right code place to get
/bin/sh running inside the notebook?
Ralf
femhub doesn't contain any sage code. In fact, the latest git version
doesn't even contain any of the sage buildsystem (except 3 little
scripts, like spkg-build)
We do have some (lots of) sage packages, for example the sagenb, and
other stuff, but we don't have anything from the sage library. So this
shows, that the sage notebook runs nicely without any Sage.
If you don't like femhub, you can just install all the dependencies
yourself (see the spkg-install scripts how to do it) and it will just
work.
Ondrej
This is now
http://trac.sagemath.org/sage_trac/ticket/9303
>
> But according to what I cite below, it should rather be
>
> except (AttributeError, ImportError):
>
> Ralf
>
> http://docs.python.org/tutorial/errors.html
>
> A try statement may have more than one except clause, to specify
> handlers for different exceptions. At most one handler will be executed.
> Handlers only handle exceptions that occur in the corresponding try
> clause, not in other handlers of the same try statement. An except
> clause may name multiple exceptions as a parenthesized tuple, for example:
>
> ... except (RuntimeError, TypeError, NameError):
> ... pass
>
--
What happens if the bug was fixed before the track ticket was reported? :)
http://boxen.math.washington.edu:8100/rev/65d6838cefd8
Ondrej
Do you have a time machine?
-- William --
Do you want one too?
Ondrej
You both have. ;-)
http://groups.google.com/group/sage-notebook/msg/8059052e1f4183d4
Note that I took
wget http://www.sagemath.org/packages/standard/sagenb-0.8.p2.spkg
since as I understand there is no central repository that contains the
latest changes that will be in the next release. Everyone points me to
the hg repo that is in the spkg.
Just a suggestion. Bless an "official (read-only) repository of the
release manager", so everyone would be up-to-date with fixes that have
already been incorporated for the new release. (This suggestion should
be applied to all hg repositories that are part of sage.)
Ralf
> 1) web user interfaces (originally a part of Codenode's frontend)
> 2) data backends (originally Codenode's frontend)
> 3) computational backends (originally Codenode's backends)
Sounds great.
> This, however, will change in future, because we would like to split
> Codenode into layers (2) and (3) to have tree cleanly separated
> projects, of course, with well defined APIs between layers.
Oh, I'd like to see this happen. Currently, I get a little confused by
files like
http://git.hpfem.org/femhub-lab.git/blob/HEAD:/src/sagenb/data/sage/images/hermes2d_logo.png
lying in a *generic* notebook. So splitting the code would be very much
appreciated.
>>> All I want is a nice web interface, that sends the input string
>>> from the cell to a (registered) process and get's corresponding
>>> output. For something like http://wiki.sagemath.org/interact,
>>> there would have to be a proper API for the backend as well. The
>>> notebook code should not contain anything that is related to the
>>> potential packends (except APIs, of course).
> This is also what we want to have.
But as you said, you basically only let python run inside a notebook
cell. What I want is that, the input is just forwarded to another
application and the output of the application is put back into the
notebook. Should probably be doable, but how would I *currently* do it
with femhub-lab. Can you point me to the code piece that takes an input,
sends it to an (arbitrary (in some way registered) interpreter and then
deals with the output from that interpreter?
I just need an entry point.
Thanks in advance.
Ralf
Ralf