On Oct 28, 2008, at 6:16 PM, David Joyner wrote:

>
> Forwarded. (It was sent to the wrong list.)
>
>
> ---------- Forwarded message ----------
> From: Martin Rubey <[EMAIL PROTECTED]>
> Date: Tue, Oct 28, 2008 at 8:34 PM
> Subject: [SAGEdev] calling python from lisp
> To:
> Cc: sage-devel <[EMAIL PROTECTED]>
>
>
> The following message is a courtesy copy of an article
> that has been posted to comp.lang.lisp,comp.lang.python as well.
>
> Dear all,
>
> I'm trying to call from common lisp functions written for Sage
> (www.sagemath.org), which in turn is written in python.  To do so,  
> I tried
> http://common-lisp.net/project/python-on-lisp/.  It was quite easy  
> to get it to
> run and do some simple things with python.
>
> However, I was unable to get sage to run within it.
>
> If I start my local python 2.5 and follow (roughly)
> http://www.sagemath.org/doc/tut/node55.html
>
> it works nicely:
>
> [EMAIL PROTECTED]:~/Documents/sage-3.1.4/local/bin$ . ./sage-env
> [EMAIL PROTECTED]:~/Documents/sage-3.1.4/local/bin$ /usr/bin/python
> Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> from sage.all import *
>>>> var('z')
> z
>>>> integrate(1/z, z)
> log(z)
>>>>
>
>
> But not so from within python-on-lisp.  Below the complete log.   
> But actually,
> the first warning occurs already when importing sys (I have little  
> python
> experience and no idea what sys contains)
>
> sys:1: RuntimeWarning: Python C API version mismatch for module pol:
> This Python has API version 1013, module pol has version 1011.
>
> As far as I understand python on lisp, it provides an interface to  
> the python
> library:
>
> (cffi:define-foreign-library python-library
>  (:darwin (:framework "Python"))
>  (:unix (:or "libpython2.5.so.1.0" "libpython2.4.so.1.0"
> "libpython2.3.so.1.0"))
>  (:windows (:or "python25.dll" "python24.dll" "python23.dll") )
>  (t (:default "libpython")))
>
> Sage comes with it's own python, however, without a library.  On  
> the otherhand,
> above I demonstrated that sage also works with the python  
> interpreter that
> comes with kubuntu.  (maybe it needs the interpreter, and the  
> library is not
> sufficient?)
>
> Help would be greatly appreciated.

Your /usr/bin/python is API version 1013, and the one we ship with  
Sage is API version 1011 (with some patches). The errors above (and  
below) are complaints about this mismatch. Some stuff will work but  
it's going to be touchy, especially anything that deals directly with  
the Python/C API (as python-on-lisp seems to do a lot). I doubt it'll  
be possible to get this working without using the Python that is  
shipped with Sage (and against which all of Sage's modules are built  
against).

- Robert




--~--~---------~--~----~------------~-------~--~----~
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