[sage-support] Re: "Drop-in" Python scripts?

2009-01-09 Thread ztnews

Thanks, guys, for the tips.  Yes, that harrison.py script I grabbed is
dated 1999(!), so no wonder it had some deprecated dependencies
(Numeric & LinearAlgebra).  Curious, tho, that two Python installs of
mine (one in Debian and another in Vista) handled the originals just
fine.

I also figured out the gnuplot issue.  I was running SAGE on the
VMWARE virtual machine, so my browser was on a different machine.  The
script generated gnuplot would show up in the VMWARE machine, and
never on my browser.

So, I've installed SAGE in a full Debian install I have (also VMWARE),
and the gnuplot stuff works as expected: pops up a plot on the machine
running SAGE.

On the whole, I'd have to say the compatibility with native Python
scripts is not bad.

Thanks again for the tips.

  -  Cronin

On Jan 8, 2:40 pm, mabshoff  wrote:
> On Jan 8, 12:03 pm, ztnews  wrote:
>
> Hi,
>
> > Forgive me if this is too obvious.  I'm still evaluating/learning the
> > basics of SAGE
>
> No problem, this is what a support group is for :)
>
> > Just how compatible is SAGE with Python?  By which I mean, should I be
> > able to just "drop-in" an existing/working python script and have it
> > run, or should I expect some modifications will be required?  And if
> > so, what's the major things I need to keep an eye out for?
>
> One thing is that you need to deal with some numerical types, i.e.
>
> sage: j=numpy.complex(0,1)
> sage: RealNumber=float
> sage: Integer=int
>
> Seehttp://www.math.washington.edu/~jkantor/Numerical_Sage/node3.html
> for more info on that.
>
>
>
> > I've looked in the documents, particularly "Coding in Python for Sage"
>
> >http://www.sagemath.org/doc/prog/node15.html
>
> > I'll illustrate by example.  I found a Python script that does a
> > physics calculation (band structure of silicon)
>
> >http://www.wag.caltech.edu/home/rpm/projects/tight-binding/harrison.py
>
> > or see here for a discussion of the script:
>
> >http://www.wag.caltech.edu/home/rpm/projects/tight-binding/
>
> > I've successfully run harrison.py (without modification) using both
> > linux and windows-based python installations.  But under SAGE (I've
> > installed the latest vmware version) required a little diddling to get
> > it (mostly) running.
>
> > Two points. 1) This script calls for modules "Numeric" and
> > "LinearAlgebra"
>
> > from Numeric import *        # Make sure that NumPy is in your
> > from LinearAlgebra import eigenvalues
>
> Numeric is the predecessor to NumPy which is in Sage. Nunmeric used to
> be at least an optional spkg for Sage, but I am not sure if it still
> works. Installing Numeric should be possible, but AFAIK this is
> seriously outdated code.
>
> > both of which failed in SAGE.  A couple minor modifications and I got
> > past those points.  I suspect these are deprecated, but still the
> > Python installations handled the script without mods.
>
> You probably have either Numeric or an older numpy installed, but I am
> not an expert about the finer details of what numeric code works with
> that numpy release (if at all)
>
> > 2) The other thing that failed was the system call to gnuplot at the
> > end of the script.  I can imagine that would be hard make work in a
> > SAGE-notebook environment, and I haven't managed that.
>
> Do you have gnuplot installed? If so what are the failures? Did the
> gnuplot part of script work with the pure Python env?
>
> > Now, my point here is not that I need that script to run,
> > particularly.  My question is about compatibility.  Have I missed
> > something about how to execute a Python script with the minimum of
> > modifications?
>
> Without going into specifics Sage ships a subset of what the usual
> distributions ship for python modules, but adds some unusual ones that
> aren't in every distribution. You can install pretty much any Python
> module by running
>
>  ./sage -sh
>  cd into unpacked python module directory
>  python setup.py install
>
> There might be problems with dependencies and so on, but for most pure
> Python code this should work really well.
>
> > Thanks for your time.  BTW, SAGE is really impressive.
>
> :)
>
> Cheers,
>
> Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Installing optional R package on sagenb.org

2009-01-09 Thread ztnews

I had a similar failure today, trying to:

r.install_packages("adapt")

after some fussing, runing ./sage as root, and using the notebook
interface I could get through the download phase, but same sorts of
failures in just as the gcc kicks in.  Seems several of the key R
scripts have "/home/wstein/..."  hard wired in to R_HOME_XXX, which
obviously will fail.  I tried editing the R startup scripts (among
others) but couldn't get it to work.

BTW, I installed from the latest Debian tarball into a Debian/VMWARE
machine just today.  So installing R packages is still an issue.

  -  Cronin


William Stein wrote:
> On Fri, Jan 2, 2009 at 6:57 PM, kcrisman  wrote:
> >
> > Dear support,
> > Because I only have OSX and there is this scary warning about it in
> > the documentation for r.install_packages (which incidentally the test
> > for it has no "s", but I don't know if that matters), I was trying to
> > load one on the sagenb site.  Probably this is a gross violation of
> > bandwidth or something,
>
> It will surely fail with a permission denied error at some point.  What
> package would you like to install?
>
> > but anyway the surprise result under the R
> > interface was
> >
> > install_packages(MASS)
> > Error: could not find function "install_packages"
>
> Try typing
>
> r.install_packages("MASS")
>
> in a normal Sage input cell.  You probably forgot the quotes.
>
> Trying this on OS X it definitely fails for me.  There is this message:
>
> "sage: r.install_packages("MASS")
> ** You are using OS X.  Unfortunately, the R optional package system
> currently doesn't support OS X very well.  We are working on this. **"
>
> I wonder who the "We" refers to?  :-)
>
> I tried the above on sagenb.org (I'm the admin, so I have permissions).
> It seems to fail as well:
>
> s...@sagenb:~$ sage
> --
> | Sage Version 3.2.2, Release Date: 2008-12-18   |
> | Type notebook() for the GUI, and license() for information.|
> --
> sage: r.install_packages("MASS")
> 0.00user 0.02system 0:00.03elapsed 82%CPU (0avgtext+0avgdata 0maxresident)k
> 64inputs+0outputs (1major+209minor)pagefaults 0swaps
>
> R version 2.6.1 (2007-11-26)
> Copyright (C) 2007 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
>   Natural language support but running in an English locale
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
> > options(repos="http://cran.r-project.org/";); install.packages("MASS")
> trying URL 'http://cran.r-project.org/src/contrib/VR_7.2-45.tar.gz'
> Content type 'application/x-gzip' length 465054 bytes (454 Kb)
> opened URL
> ==
> downloaded 454 Kb
>
> WARNING: ignoring environment value of R_HOME
> /home/sage/sage/local/lib/R/library
> WARNING: ignoring environment value of R_HOME
> * Installing *source* package 'MASS' ...
> ** libs
> gcc -std=gnu99 -I/home/sage/sage/local/lib/R/include
> -I/home/sage/sage/local/lib/R/include  -I/home/sage/sage/local/inlcude
> WARNING: ignoring environment value of R_HOME   -fpic
> -I/home/sage/sage/local/include -L/home/sage/sage/local/lib/  -c lqs.c
> -o lqs.o
> gcc: WARNING:: No such file or directory
> gcc: ignoring: No such file or directory
> gcc: environment: No such file or directory
> gcc: value: No such file or directory
> gcc: of: No such file or directory
> gcc: R_HOME: No such file or directory
> make: *** [lqs.o] Error 1
> ERROR: compilation failed for package 'MASS'
> ** Removing '/home/sage/sage/local/lib/R/library/MASS'
> ** Removing '/home/sage/sage/local/lib/R/library/class'
> ** Removing '/home/sage/sage/local/lib/R/library/nnet'
> ** Removing '/home/sage/sage/local/lib/R/library/spatial'
>
> The downloaded packages are in
>   /tmp/RtmpoUnbs5/downloaded_packages
> Updating HTML index of packages in '.Library'
> Warning message:
> In install.packages("MASS") :
>   installation of package 'VR' had non-zero exit status
> >
>
>
>
> >
> > which was surprising since tab-completion was how I found this
> > function in the first place.  I also got this in the Sage interface
> > with r.install_packages.
> >
> > If anyone knows how I might do this, or if it's not good to do, or
> > whether my Mac will actually allow me to install the optional package
> > after all, OR whether Sage actually includes these by default (which
> > doesn't seem to be the case, but I might have typed something wrong),
> > I would greatly

[sage-support] "Drop-in" Python scripts?

2009-01-08 Thread ztnews

Forgive me if this is too obvious.  I'm still evaluating/learning the
basics of SAGE

Just how compatible is SAGE with Python?  By which I mean, should I be
able to just "drop-in" an existing/working python script and have it
run, or should I expect some modifications will be required?  And if
so, what's the major things I need to keep an eye out for?

I've looked in the documents, particularly "Coding in Python for Sage"

http://www.sagemath.org/doc/prog/node15.html

I'll illustrate by example.  I found a Python script that does a
physics calculation (band structure of silicon)

http://www.wag.caltech.edu/home/rpm/projects/tight-binding/harrison.py

or see here for a discussion of the script:

http://www.wag.caltech.edu/home/rpm/projects/tight-binding/

I've successfully run harrison.py (without modification) using both
linux and windows-based python installations.  But under SAGE (I've
installed the latest vmware version) required a little diddling to get
it (mostly) running.

Two points. 1) This script calls for modules "Numeric" and
"LinearAlgebra"

from Numeric import *# Make sure that NumPy is in your
from LinearAlgebra import eigenvalues

both of which failed in SAGE.  A couple minor modifications and I got
past those points.  I suspect these are deprecated, but still the
Python installations handled the script without mods.

2) The other thing that failed was the system call to gnuplot at the
end of the script.  I can imagine that would be hard make work in a
SAGE-notebook environment, and I haven't managed that.

Now, my point here is not that I need that script to run,
particularly.  My question is about compatibility.  Have I missed
something about how to execute a Python script with the minimum of
modifications?

Thanks for your time.  BTW, SAGE is really impressive.

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