On Wed, Jul 9, 2008 at 4:32 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
> On Wed, Jul 9, 2008 at 7:27 AM, William Stein <[EMAIL PROTECTED]> wrote:
>>
>> On Tue, Jul 8, 2008 at 10:21 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>>> On Wed, Jul 9, 2008 at 2:29 AM, François Bissey <[EMAIL PROTECTED]> wrote:
>>>>
>>>> On Wed, 09 Jul 2008, Ondrej Certik wrote:
>>>>> The only remaining annoying thing is this one LD_LIBRARY_PATH thing.
>>>>> I'll probably put it to my .bashrc, as there doesn't seem to be any
>>>>> way around it.
>>>>>
>>>> It's probably better to make a small launcher script setting the variable
>>>> correctly. I have seen .*shrc littered with stuff (users in physical
>>>> chemistry), in the end it is difficult to know if some settings contradict
>>>> others.
>>>> I now actively encourage them to write a small launcher script instead.
>>>
>>> I see. Well, one can just use "sage" as the launcher script. The
>>> problem in my case was to get rid of the launcher script, so that I
>>> can use tools
>>> like py.test or nosetests.
>>>
>>> BTW, does anyone know what the:
>>>
>>> Falling back to a hard coded sage server in misc/hg.py
>>>
>>> means and how to get rid of it?
>>
>> It means the environment variable SAGE_SERVER isn't set.  Set it to 
>> something.
>
> That worked thanks. BTW, it needs to be set to
> "http://www.sagemath.org/";, otherwise I get this:
>
> Non-default server settings detected:
>    Incoming Server = misc/hg.py/hg
>    Outgoing Server = misc/hg.py/hg
>
> I updated the wiki with my new script:
>
> http://wiki.sagemath.org/Sage_in_systemwide_python

Two questions:

(1)   I'm having a hard time with this script.
I couldn't find the SAGE_SERVER set in your new script, so added it as follows:
Create a file sage-in-ipython, and run chmod a+x run-sage:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#! /bin/bash
# Once Ipython starts, please type
# In [1]: from sage.all import *
# to start Sage.

export SAGE_ROOT=/home/wdj/sagefiles/sage-3.0.4.rc0
export SAGE_SERVER="http://www.sagemath.org/";

export SAGE_LOCAL=$SAGE_ROOT/local
export DOT_SAGE=~/.sage/
export PATH=$SAGE_ROOT/local/bin:$PATH

export LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/openmpi:$SAGE_ROOT/local/lib/:"

export 
PYTHONPATH="$SAGE_ROOT/local/bin:$SAGE_ROOT/local/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg:$SAGE_ROOT/local/lib/python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg:$SAGE_ROOT/local/bin:$SAGE_ROOT/local/lib/python:$SAGE_ROOT/local/lib/python25.zip:$SAGE_ROOT/local/lib/python2.5/plat-linux2:$SAGE_ROOT/local/lib/python2.5/lib-tk:$SAGE_ROOT/local/lib/python2.5/lib-dynload:$SAGE_ROOT/local/lib/python2.5/site-packages:$SAGE_ROOT/local/lib/python2.5/site-packages/IPython/Extensions"

ipython

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now, it says sage cannot be found:


[EMAIL PROTECTED]:~/sagefiles/sage-3.0.4.rc0$ ./sage-in-ipython
Python 2.5.2 (r252:60911, Jul  7 2008, 23:27:12)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.2 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from sage.all import *
sh: sage: not found
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/wdj/sagefiles/sage-3.0.4.rc0/<ipython console> in <module>()

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/all.py
in <module>()
     84 from sage.functions.all  import *
     85 from sage.calculus.all   import *
---> 86 from sage.server.all     import *
     87 from sage.dsage.all      import *
     88 import sage.tests.all as tests

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/server/all.py
in <module>()
      1 #from server1.all import *
----> 2 from notebook.all import *
      3 from wiki.all import *
      4 from trac.all import *
      5

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/server/notebook/all.py
in <module>()
     11 #from twist import notebook_twisted as notebook
     12
---> 13 from notebook_object import notebook, inotebook
     14
     15 from sagetex import sagetex

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/server/notebook/notebook_object.py
in <module>()
     17 import time, os, shutil, signal, tempfile
     18
---> 19 import notebook as _notebook
     20
     21 import run_notebook

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/server/notebook/notebook.py
in <module>()
     45 JQUERY = True
     46
---> 47 if is_package_installed("jsmath-image-fonts"):
     48     JSMATH_IMAGE_FONTS = True
     49 else:

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/misc/package.py
in is_package_installed(package)
     71         True
     72     """
---> 73     return any(p.startswith(package) for p in install_package())
     74
     75 def standard_packages():

/home/wdj/sagefiles/sage-3.0.4.rc0/local/lib/python2.5/site-packages/sage/misc/package.py
in install_package(package, force)
     54         if __installed_packages is None:
     55             X = os.popen('sage -f').read().split('\n')
---> 56             i = X.index('Currently installed packages:')
     57             X = [Y for Y in X[i+1:] if Y != '']
     58             X.sort()

ValueError: list.index(x): x not in list

In [2]:


I am mystified - do you see the problem with my script?


(2) If this was to be run from SAGE_ROOT (ie,
/home/wdj/sagefiles/sage-3.0.4.rc0
in my case), could I replace the line

export SAGE_ROOT=/home/wdj/sagefiles/sage-3.0.4.rc0

by

export SAGE_ROOT=.

and have the same effect? This would be independent of the user's setup and
allow the script to be distributed with sage, if William and other
developers wanted to do so.
It certainly wouldn't bother me to have this extra option of starting SAGE.

>
> it's getting quite convenient now, I only need to set the path to Sage
> install at exactly one point in the script and it will tell me the
> exact command to run if the sage import fails.
>
> Ondrej
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to