Difference between revisions of "Sage"
m (→Gurobi backend) |
|||
(41 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | ==Installations & upgrades== |
||
− | ===Installation=== |
||
+ | ===Initial installation 2.10=== |
||
− | Some notes on the installation of [http://www.sagemath.org/ Sage] in a vserver: |
||
+ | Some notes on the installation of [http://www.sagemath.org/ Sage] (v2.10) in a vserver: |
||
Create a vserver, remove tmpfs /tmp in /etc/vservers/sage/fstab as 16M is too short for compilation |
Create a vserver, remove tmpfs /tmp in /etc/vservers/sage/fstab as 16M is too short for compilation |
||
Line 81: | Line 82: | ||
fi |
fi |
||
screen -d -m -S sage su -s /bin/bash - $USER -c "$DAEMON $ARGS" |
screen -d -m -S sage su -s /bin/bash - $USER -c "$DAEMON $ARGS" |
||
+ | sleep 1 |
||
# PID of screen |
# PID of screen |
||
PID=$(screen -ls sage|grep sage|sed 's/[[:space:]]*\([0-9]\+\)\..*/\1/') |
PID=$(screen -ls sage|grep sage|sed 's/[[:space:]]*\([0-9]\+\)\..*/\1/') |
||
Line 167: | Line 169: | ||
# update-rc.d saged defaults 99 01 |
# update-rc.d saged defaults 99 01 |
||
− | === |
+ | ===Upgrade to 2.10.1=== |
+ | I had many troubles because of a caching proxy |
||
+ | <br>A ticket was filled for this issue: http://trac.sagemath.org/sage_trac/ticket/2043 |
||
+ | <br>Meanwhile I tried to get around so I copied manually |
||
+ | http://www.sagemath.org/packages/standard/list -> /opt/sage-2.10/spkg/standard |
||
+ | http://www.sagemath.org/packages/standard/deps -> /opt/sage-2.10/spkg/standard |
||
+ | http://www.sagemath.org/packages/standard/newest_version -> /opt/sage-2.10/spkg/standard |
||
+ | http://www.sagemath.org/packages/standard/README -> /opt/sage-2.10/spkg/standard |
||
+ | http://www.sagemath.org/packages/install -> /opt/sage-2.10/spkg |
||
+ | then I had to avoid that download happens during sage -upgrade: |
||
+ | /opt/sage-2.10/local/bin/sage-update lines download_file("standard/list") etc |
||
+ | During sage -upgrade the version control system prompted me, I guess for the sage-update script, I simply quitted the changelog editor and it continued. |
||
+ | <br>But now I see that the upgrade of sage_scripts-2.10.1 was not complete. |
||
+ | <br>The solution to ignore local changes is to delete the directory local/bin/.hg and install again the scripts package: |
||
+ | sage -f sage_scripts-2.10.1 |
||
+ | |||
+ | I had also to install a zlib headers package because libpng compilation failed using the local zlib headers. |
||
+ | apt-get install zlib1g-dev |
||
+ | A ticket was filled for this issue: http://trac.sagemath.org/sage_trac/ticket/2043 |
||
+ | <br>I tested it: |
||
+ | apt-get remove zlib1g-dev |
||
+ | cd /opt/sage-2.10/spkg/standard |
||
+ | wget http://sage.math.washington.edu/home/mabshoff/SPKG/libpng-1.2.22.p5.spkg |
||
+ | sage -i libpng-1.2.22.p5 |
||
+ | But still the same error, ongoing... |
||
+ | ===Install 2.10.3=== |
||
+ | To upgrade to 2.10.3 I simply took the full sources under /opt/sage-2.10.3, did <code>make</code> |
||
+ | <br>and modified the path in /usr/local/bin/sage |
||
+ | <br>For the optional packages, as most didn't change their version, I transferred them from the old install to /opt/sage-2.10.3/spkg/optional before installing them with <code>sage -i ''package''</code> |
||
+ | <br>Note that this full installation relied on the scripts & setup I installed before, cf the initial installation described at the top of the page. |
||
+ | ===Install 2.11=== |
||
+ | To upgrade to 2.11 I simply took the full sources under /opt/sage-2.11, did <code>make</code> |
||
+ | <br>and modified the path in /usr/local/bin/sage |
||
+ | <br>I also ran <code>make test</code> and that was ok. |
||
+ | <br>But on a second machine I got an error at compile time, g++ killed. That was due to exhaused memory so I stopped the Sage notebook during the compilation of the new version and it went fine. |
||
+ | |||
+ | TODO: transfer the optional packages |
||
+ | ===Install 3.0.3=== |
||
+ | Same as usual, no special comment. |
||
+ | ===Install 3.1.1=== |
||
+ | This time I tried successfully the pre-compiled version at http://sage.apcocoa.org/linux/64bit/sage-3.1.1-debian64-opteron-x86_64-Linux.tar.gz |
||
+ | and modified the path in /usr/local/bin/sage |
||
+ | <br>Then run sage as the install user |
||
+ | ---------------------------------------------------------------------- |
||
+ | | SAGE Version 3.1.1, Release Date: 2008-08-17 | |
||
+ | | Type notebook() for the GUI, and license() for information. | |
||
+ | ---------------------------------------------------------------------- |
||
+ | The SAGE install tree may have moved. |
||
+ | Regenerating Python.pyo and .pyc files that hardcode the install PATH (please wait at most a few minutes)... |
||
+ | Please do not interrupt this. |
||
+ | ===Install 5.0.1=== |
||
+ | root@sagemath:~# su -s /bin/bash - sage |
||
+ | sage@sagemath:~$ cd /opt |
||
+ | sage@sagemath:/opt$ tar -x --lzma -f sage-5.0.1-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux.tar.lzma |
||
+ | sage@sagemath:/opt$ ln -s sage-5.0.1-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux sage |
||
+ | sage@sagemath:~$ sage |
||
+ | ====Gurobi backend==== |
||
+ | cf http://www.sagemath.org/doc/thematic_tutorials/linear_programming.html |
||
+ | <br>If no direct Internet connection is available: |
||
+ | $ ssh -R8008:apps.gurobi.com:8008 root@sagemath |
||
+ | root@sagemath:~# su -s /bin/bash - sage |
||
+ | sage@sagemath:~$ /opt/gurobi500/linux64/bin/grbgetkey --server=127.0.0.1 --verbose abcdefgh-1234-1234-1234-123456789abc |
||
+ | => /home/sage/gurobi.lic |
||
+ | sage@sagemath:~$ ln -s /opt/gurobi500/linux64/include/gurobi_c.h /opt/sage/local/include |
||
+ | sage@sagemath:~$ ln -s /opt/gurobi500/linux64/lib/libgurobi.so.5.0.0 /opt/sage/local/lib/libgurobi.so |
||
+ | sage@sagemath:~$ sage -b |
||
+ | |||
+ | ==jsMath fonts== |
||
+ | ===Client tuning=== |
||
If you want to install the jsMath fonts locally on your client for a faster rendering: |
If you want to install the jsMath fonts locally on your client for a faster rendering: |
||
<br>[http://www.math.union.edu/~dpvc/jsMath/download/jsMath-fonts.html Download TEX fonts] and install them either in ~/.fonts/ or C:\Windows\Fonts |
<br>[http://www.math.union.edu/~dpvc/jsMath/download/jsMath-fonts.html Download TEX fonts] and install them either in ~/.fonts/ or C:\Windows\Fonts |
||
+ | ===Server tuning=== |
||
+ | You can also install [http://www.sagemath.org:9002/sage_trac/ticket/1971 the fonts as images on the server] so that clients without the TeX fonts will still see a proper result. It's not part of the standard Sage install by default because of its size (80Mb). |
||
+ | sage$ sage -i jsmath-image-fonts-1.3 |
||
+ | ==SSH & X11 PortForwarding== |
||
===SAGE console via ssh=== |
===SAGE console via ssh=== |
||
Some notes to give a console access with python autocompletion: |
Some notes to give a console access with python autocompletion: |
||
Line 182: | Line 256: | ||
Some notes to enable X11 forwarding with the sage console: |
Some notes to enable X11 forwarding with the sage console: |
||
apt-get install xbase-clients |
apt-get install xbase-clients |
||
− | vi /etc/ssh/sshd_config |
+ | vi /etc/ssh/sshd_config |
X11Forwarding yes |
X11Forwarding yes |
||
#if you're in a vserver: |
#if you're in a vserver: |
||
Line 192: | Line 266: | ||
User saged |
User saged |
||
ForwardX11 yes |
ForwardX11 yes |
||
+ | |||
===Maxima plot via X11=== |
===Maxima plot via X11=== |
||
Some notes to enable tcl/tk interactive plotting with maxima: |
Some notes to enable tcl/tk interactive plotting with maxima: |
||
Line 216: | Line 291: | ||
apt-get install octave gnuplot |
apt-get install octave gnuplot |
||
− | sage -i gnuplotpy-1.7.p3 |
||
Test: |
Test: |
||
ssh sage |
ssh sage |
||
Line 226: | Line 300: | ||
sage: octave.de_system_plot(['x+y', 'x-y'], [1, -1], [0,2]) |
sage: octave.de_system_plot(['x+y', 'x-y'], [1, -1], [0,2]) |
||
+ | |||
===singular & surf via X11=== |
===singular & surf via X11=== |
||
Some notes to enable surf for singular: |
Some notes to enable surf for singular: |
||
Line 240: | Line 315: | ||
make |
make |
||
ln -s /opt/surf-1.0.5/surf /usr/local/bin |
ln -s /opt/surf-1.0.5/surf /usr/local/bin |
||
+ | To run the binary, you don't need all the header packages but you still need some libraries (if you compiled from sources you already have it) |
||
+ | apt-get install libgmp3c2 libgtk1.2 |
||
Test: |
Test: |
||
ssh sage |
ssh sage |
||
Line 264: | Line 341: | ||
"Press q to exit from 'surf'" |
"Press q to exit from 'surf'" |
||
+ | ==Importing Python packages== |
||
+ | ===System wide Python packages=== |
||
+ | install the package |
||
+ | # python setup.py install |
||
+ | '''or''' add the --record option to make a list of files which where installed for easy removal later |
||
+ | # python setup.py install --record install.log |
||
+ | append the python path in sage |
||
+ | sage: import sys |
||
+ | sage: sys.path.append('/usr/lib/python2.5/site-packages') |
||
+ | import the package, for example: |
||
+ | sage: import M2Crypto |
||
+ | removal of the package: |
||
+ | cat install.log | xargs rm |
||
+ | ====Alternative way to install python package==== |
||
+ | On Red Hat/Fedora: |
||
+ | $ python setup.py bdist_rpm |
||
+ | On Debian/Ubuntu: |
||
+ | <br>Same step then use alien to transform the .rpm into a .deb |
||
+ | |||
+ | => easy removal of the python package is possible |
||
+ | |||
+ | ===Import to local Sage Python path=== |
||
+ | install the script to the Sage Python path |
||
+ | $ sage-python setup.py install |
||
+ | in sage: just import, that's it |
||
+ | sage: import M2Crypto |
||
+ | ===Import user Python modules=== |
||
+ | It will be soon possible for a user without administrator privileges on the server to import the path to their module in a more elegant way than the sys.path.append(), cf [http://trac.sagemath.org/sage_trac/ticket/3784] |
||
+ | <br><cite>I propose offering a workaround, e.g. SAGE_PYTHONPATH which *does* get appended to PYTHONPATH on startup.</cite> |
||
+ | ==[[Python|Installing development Python packages]]== |
||
+ | |||
+ | ==Interfaces to proprietary software== |
||
===Maple=== |
===Maple=== |
||
Some notes if you want to use your Maple 32-bit on a 64-bit arch: |
Some notes if you want to use your Maple 32-bit on a 64-bit arch: |
||
Line 271: | Line 380: | ||
Or from Sage: |
Or from Sage: |
||
maple.fsolve('x^2=cos(x)+4', 'x=0..5') |
maple.fsolve('x^2=cos(x)+4', 'x=0..5') |
||
+ | ===Maple via X11=== |
||
+ | You need X11 forwarding, cf above |
||
+ | <br>Test: |
||
+ | ssh sage |
||
+ | Last login: blabla |
||
+ | ---------------------------------------------------------------------- |
||
+ | | SAGE Version 2.10, Release Date: 2008-01-18 | |
||
+ | | Type notebook() for the GUI, and license() for information. | |
||
+ | ---------------------------------------------------------------------- |
||
+ | sage: sh.eval("xmaple") |
||
+ | ==[[SAGE & cryptology]]== |
Latest revision as of 09:47, 16 July 2012
Installations & upgrades
Initial installation 2.10
Some notes on the installation of Sage (v2.10) in a vserver:
Create a vserver, remove tmpfs /tmp in /etc/vservers/sage/fstab as 16M is too short for compilation
Create an account for the compilation
# adduser --disabled-password --shell /bin/false sage
Install packages needed for the compilation + some for runtime
# apt-get install gcc-4.1-base make m4 bison flex tar perl binutils \ libstdc++6-dev g++ openssh-client \ less screen imagemagick
Download and compile sources
# cd /opt # export http_proxy=http://proxy....:8080 # wget http://www.sagemath.org/dist/src/sage-2.10.tar # tar xf sage-2.10.tar # chown -R sage:sage * # su -s /bin/bash - sage sage$ cd /opt/sage-2.10/ sage$ make
Time for triple coffee...
To maintain the installation and install optional packages:
sage$ export http_proxy=http://proxy....:8080 sage$ ./sage -upgrade sage$ ./sage -optional sage$ ./sage -i extra_docs- sage$ ./sage -i openssl-0.9.8d.p1 sage$ ./sage -i pyopenssl-0.6 sage$ ./sage -i gap_packages-4.4.10_3 sage$ ./sage -i database_gap-4.4.10 ...
Create an account to run sage as webserver
# adduser --disabled-password --shell /bin/false saged # cp /opt/sage-2.10/sage /home/install
Edit the launch script /home/install/sage to point to the right directory:
SAGE_ROOT="/opt/sage-2.10" # ln -s /home/install/sage /usr/local/bin
To start & stop the webserver as a real daemon, in a screen session, save the following script as /home/install/saged:
#! /bin/sh # Author: Philippe Teuwen # Do NOT "set -e" PATH=/usr/sbin:/usr/bin:/sbin:/bin DESC="Launching SAGE webserver" NAME=sage PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME DAEMON=/usr/local/bin/sage HOST="fqdn.of.the.server" PORT="8000" ARGS="-c \"notebook(address=\\\"$HOST\\\",port=$PORT,accounts=true)\"" USER=saged # Exit if mysql client is not installed [ -x "$DAEMON" ] || exit 0 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { if [ -e $PIDFILE ]; then if ps -p $(cat $PIDFILE) >/dev/null; then echo -n -e "\nError: $NAME seems to be already running!" return 1 else rm -f $PIDFILE fi fi screen -d -m -S sage su -s /bin/bash - $USER -c "$DAEMON $ARGS" sleep 1 # PID of screen PID=$(screen -ls sage|grep sage|sed 's/[[:space:]]*\([0-9]\+\)\..*/\1/') # PID of su PID=$(ps --ppid $PID -o pid --no-headers) # PID of sage PID=$(ps --ppid $PID -o pid --no-headers) echo $PID > $PIDFILE } # # Function that stops the daemon/service # do_stop() { if [ -e $PIDFILE ]; then PID=$(cat $PIDFILE) if ps -p $PID > /dev/null; then # kill script kill $PID rm -f $PIDFILE return 0 else echo -e "\nWarning: $NAME was not running." echo -n -e "\nCleaning PID file" rm -f $PIDFILE return 1 fi else echo -n -e "\nWarning: $NAME was not running" return 1 fi } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias # log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac :
If you don want anybody to be able to create an account (which gives access to bash!!), remove ",accounts=true" from ARGS.
Install the script:
# ln -s /home/install/saged /etc/init.d # update-rc.d saged defaults 99 01
Upgrade to 2.10.1
I had many troubles because of a caching proxy
A ticket was filled for this issue: http://trac.sagemath.org/sage_trac/ticket/2043
Meanwhile I tried to get around so I copied manually
http://www.sagemath.org/packages/standard/list -> /opt/sage-2.10/spkg/standard http://www.sagemath.org/packages/standard/deps -> /opt/sage-2.10/spkg/standard http://www.sagemath.org/packages/standard/newest_version -> /opt/sage-2.10/spkg/standard http://www.sagemath.org/packages/standard/README -> /opt/sage-2.10/spkg/standard http://www.sagemath.org/packages/install -> /opt/sage-2.10/spkg
then I had to avoid that download happens during sage -upgrade:
/opt/sage-2.10/local/bin/sage-update lines download_file("standard/list") etc
During sage -upgrade the version control system prompted me, I guess for the sage-update script, I simply quitted the changelog editor and it continued.
But now I see that the upgrade of sage_scripts-2.10.1 was not complete.
The solution to ignore local changes is to delete the directory local/bin/.hg and install again the scripts package:
sage -f sage_scripts-2.10.1
I had also to install a zlib headers package because libpng compilation failed using the local zlib headers.
apt-get install zlib1g-dev
A ticket was filled for this issue: http://trac.sagemath.org/sage_trac/ticket/2043
I tested it:
apt-get remove zlib1g-dev cd /opt/sage-2.10/spkg/standard wget http://sage.math.washington.edu/home/mabshoff/SPKG/libpng-1.2.22.p5.spkg sage -i libpng-1.2.22.p5
But still the same error, ongoing...
Install 2.10.3
To upgrade to 2.10.3 I simply took the full sources under /opt/sage-2.10.3, did make
and modified the path in /usr/local/bin/sage
For the optional packages, as most didn't change their version, I transferred them from the old install to /opt/sage-2.10.3/spkg/optional before installing them with sage -i package
Note that this full installation relied on the scripts & setup I installed before, cf the initial installation described at the top of the page.
Install 2.11
To upgrade to 2.11 I simply took the full sources under /opt/sage-2.11, did make
and modified the path in /usr/local/bin/sage
I also ran make test
and that was ok.
But on a second machine I got an error at compile time, g++ killed. That was due to exhaused memory so I stopped the Sage notebook during the compilation of the new version and it went fine.
TODO: transfer the optional packages
Install 3.0.3
Same as usual, no special comment.
Install 3.1.1
This time I tried successfully the pre-compiled version at http://sage.apcocoa.org/linux/64bit/sage-3.1.1-debian64-opteron-x86_64-Linux.tar.gz
and modified the path in /usr/local/bin/sage
Then run sage as the install user
---------------------------------------------------------------------- | SAGE Version 3.1.1, Release Date: 2008-08-17 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- The SAGE install tree may have moved. Regenerating Python.pyo and .pyc files that hardcode the install PATH (please wait at most a few minutes)... Please do not interrupt this.
Install 5.0.1
root@sagemath:~# su -s /bin/bash - sage sage@sagemath:~$ cd /opt sage@sagemath:/opt$ tar -x --lzma -f sage-5.0.1-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux.tar.lzma sage@sagemath:/opt$ ln -s sage-5.0.1-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux sage sage@sagemath:~$ sage
Gurobi backend
cf http://www.sagemath.org/doc/thematic_tutorials/linear_programming.html
If no direct Internet connection is available:
$ ssh -R8008:apps.gurobi.com:8008 root@sagemath root@sagemath:~# su -s /bin/bash - sage sage@sagemath:~$ /opt/gurobi500/linux64/bin/grbgetkey --server=127.0.0.1 --verbose abcdefgh-1234-1234-1234-123456789abc => /home/sage/gurobi.lic sage@sagemath:~$ ln -s /opt/gurobi500/linux64/include/gurobi_c.h /opt/sage/local/include sage@sagemath:~$ ln -s /opt/gurobi500/linux64/lib/libgurobi.so.5.0.0 /opt/sage/local/lib/libgurobi.so sage@sagemath:~$ sage -b
jsMath fonts
Client tuning
If you want to install the jsMath fonts locally on your client for a faster rendering:
Download TEX fonts and install them either in ~/.fonts/ or C:\Windows\Fonts
Server tuning
You can also install the fonts as images on the server so that clients without the TeX fonts will still see a proper result. It's not part of the standard Sage install by default because of its size (80Mb).
sage$ sage -i jsmath-image-fonts-1.3
SSH & X11 PortForwarding
SAGE console via ssh
Some notes to give a console access with python autocompletion:
Put ssh keys in /home/saged/.ssh/authorized_keys
Set /usr/local/bin/sage as shell of user saged in /etc/passwd
Then on the client side:
Host sage Hostname blabla User saged
SAGE console via ssh with X11 forwarding
Some notes to enable X11 forwarding with the sage console:
apt-get install xbase-clients vi /etc/ssh/sshd_config X11Forwarding yes #if you're in a vserver: X11UseLocalhost no /etc/init.d/ssh restart
Then on the client side:
Host sage Hostname blabla User saged ForwardX11 yes
Maxima plot via X11
Some notes to enable tcl/tk interactive plotting with maxima:
You need X11 forwarding, cf above
apt-get install tk8.4
Test:
ssh sage Last login: blabla ---------------------------------------------------------------------- | SAGE Version 2.10, Release Date: 2008-01-18 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: maxima.plot2d('cos(2*x) + 2*cos(x)','[x,0,1]','[plot_format,openmath]')
or
sage: maxima.eval('load("plotdf")') sage: maxima.eval('plotdf(x+y,[trajectory_at,2,-0.1]);')
or
sage: maxima.plot3d("sin(x^2+y^2)","[x,-3,3]","[y,-3,3]",'[plot_format,openmath]')
octave & gnuplot via X11
Some notes to enable octave and gnuplot:
You need X11 forwarding, cf above
apt-get install octave gnuplot
Test:
ssh sage Last login: blabla ---------------------------------------------------------------------- | SAGE Version 2.10, Release Date: 2008-01-18 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: octave.de_system_plot(['x+y', 'x-y'], [1, -1], [0,2])
singular & surf via X11
Some notes to enable surf for singular:
You need X11 forwarding, cf above
We need to compile surf from the sources:
apt-get install zlib1g-dev libjpeg62-dev libtiff4-dev flex \ libgmp3-dev libgtk1.2-dev libx11-dev libxmu-headers libxmu-dev cd /opt wget "http://downloads.sourceforge.net/surf/surf-1.0.5.tar.gz" tar xzf surf-1.0.5.tar.gz cd surf-1.0.5/ ./configure make ln -s /opt/surf-1.0.5/surf /usr/local/bin
To run the binary, you don't need all the header packages but you still need some libraries (if you compiled from sources you already have it)
apt-get install libgmp3c2 libgtk1.2
Test:
ssh sage Last login: blabla ---------------------------------------------------------------------- | SAGE Version 2.10, Release Date: 2008-01-18 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: s = singular.eval sage: s('LIB "surf.lib";') '// ** loaded /opt/sage-2.10/local/LIB/surf.lib (1.28,2007/07/13)' sage: s("ring rr0 = 0, (x1,x2),dp;") sage: s("ideal I = x1^3 - x2^2;") sage: s("plot(I);") "Press q to exit from 'surf'"
or
sage: singular.eval('ring rr1 = 0,(x,y,z),dp;') sage: singular.eval('ideal I(1) = 2x2-1/2x3 +1-y+1;') sage: singular.eval('plot(I(1));') "Press q to exit from 'surf'"
Importing Python packages
System wide Python packages
install the package
# python setup.py install
or add the --record option to make a list of files which where installed for easy removal later
# python setup.py install --record install.log
append the python path in sage
sage: import sys sage: sys.path.append('/usr/lib/python2.5/site-packages')
import the package, for example:
sage: import M2Crypto
removal of the package:
cat install.log | xargs rm
Alternative way to install python package
On Red Hat/Fedora:
$ python setup.py bdist_rpm
On Debian/Ubuntu:
Same step then use alien to transform the .rpm into a .deb
=> easy removal of the python package is possible
Import to local Sage Python path
install the script to the Sage Python path
$ sage-python setup.py install
in sage: just import, that's it
sage: import M2Crypto
Import user Python modules
It will be soon possible for a user without administrator privileges on the server to import the path to their module in a more elegant way than the sys.path.append(), cf [1]
I propose offering a workaround, e.g. SAGE_PYTHONPATH which *does* get appended to PYTHONPATH on startup.
Installing development Python packages
Interfaces to proprietary software
Maple
Some notes if you want to use your Maple 32-bit on a 64-bit arch:
apt-get install ia32-libs /bin/maple -binary IBM_INTEL_LINUX
Or from Sage:
maple.fsolve('x^2=cos(x)+4', 'x=0..5')
Maple via X11
You need X11 forwarding, cf above
Test:
ssh sage Last login: blabla ---------------------------------------------------------------------- | SAGE Version 2.10, Release Date: 2008-01-18 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: sh.eval("xmaple")