[sage-support] Re: Problems Installing Python Libraries
I only use "sage -python" or "sage -ipython" with PyCUDA stuff, so that part's probably right. I'm running 64-bit Fedora and 64-bit CUDA (straight from NVIDIA, I had to fight a fair bit with this to work with Fedora 11's 4.4 gcc), and PyCUDA's tests work fine with Sage's Python. I would try to get PyCUDA working with Sage's Python than try to get Sage to use non-Sage Python but I wish you luck on your gamble. On Mon, Mar 1, 2010 at 11:19 PM, Matthew Bromberg wrote: > I actually got to the point where it would install using a similar > approach. I've been using the special shell environment for sage that > forces the correct python paths and so forth. Unfortunately my install > segfaults when I try to run the tests. My systems python will run the > pycuda tests without complaining. Unfortunately I haven't had a chance to > dig much further. > > My next trick was going to be to attempt to make sage use my system > python. I found a website that walks you through the procedure, but I've > been so busy I haven't had a chance to try it. > > Out of curiosity are you running a 64 bit or 32 bit version of linux? I'm > running a 64 bit archlinux. I'm wondering if my cuda libraries are > compatible with the sandboxed python. > > On 3/1/2010 2:09 PM, Ahmed Fasih wrote: > > Ignoring the oft-considered and oft-rejected suggestion that Sage > integrate with its host system, I take it that you couldn't get PyCUDA > 0.9.3 working. I just got it working with Sage, Fedora 11, etc. > > When installing Boost 1.4.2, I made sure to "./bootstrap.sh --help" > and see how to provide the correct Python path. My project-config.jam > had the following line: > > using python : 2.6 : /home/aldebrn/sage/local ; > > Then of course PyCUDA wouldn't build. Here's the command I had to run: > > $ sage -python configure.py --boost-inc-dir=/home/aldebrn/pool/include > --boost-lib-dir=$HOME/pool/lib --boost-python-libname=boost_python -- > boost-thread-libname=boost_thread --cuda-root=/usr/local/cuda > > Note that boost_python and boost_thread were from my boost/lib > directories. I also had to symlink libcuda.so from /usr/local/cuda/ > lib64 to /usr/local/cuda/lib. > > Then I ran into this utterly absurd setuptools junk. I'll take my > queue from Andreas' restraint and not complain bitterly like I want > to. Anyway, after going into my sage/local/lib/python2.6/site-packages > directory and > > $ rm setuptools* > > then going to my sage/local and deleting everything that > > $ find | grep easy_install > > revealed, I was able to build PyCUDA with "make install" and test it. > It does complain about something, but it works: > > $ sage -python test_driver.py > /home/aldebrn/sage/local/lib/python2.6/site-packages/pycuda-0.93-py2.6- > linux-x86_64.egg/pycuda/compiler.py:11: UserWarning: > call_capture_stdout is deprecated: use call_capture_output instead > return call_capture_stdout([nvcc, "--version"]) > > -- > Ran 16 tests in 4.719s > > OK > > Hope this helps some hapless soul. > > On Feb 20, 8:52 pm, SevenThunders > wrote: > > > I posted this on the development list, but maybe I should have posted > here: > > I have an archlinux x86-64 desktop and I successfully installed > (compiled) sage. I'd like to add some additional functionality > however, but I've been stymied by a number of issues. First my top > issue is to get pycuda working with sage, which apparently others > have done. Unfortunately sage has an installation of setuptools which > doesn't work with pycuda, and is supposed to be somewhat deprecated as > of python 2.6.4. > > -- > I get an error of this type: > Does your error message look like this? > > "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c9- > py2.6.egg/setuptools/command/build_ext.py", > line 85, in get_ext_filename > KeyError: '_something' > > You are using Python 2.6.3 with Setuptools. This will not work. > Uninstall setuptools, install > distribute.http://wiki.tiker.net/DistributeVsSetuptools#switching > --- > > Two other python libraries I could not install are PyQt4 and pygtk. > The latter runs up against an error: > -- > /usr/bin/ld: /opt/sage/sage/local/lib/../lib/ > libpython2.6.a(abstract.o): relocation R_X86_64_32 against > `.rodata.str1.8' can not be used when making a shared object; > recompile with -fPIC > /opt/sage/sage/local/lib/../lib/libpython2.6.a: could not read > symbols: B
[sage-support] Re: Problems Installing Python Libraries
Ignoring the oft-considered and oft-rejected suggestion that Sage integrate with its host system, I take it that you couldn't get PyCUDA 0.9.3 working. I just got it working with Sage, Fedora 11, etc. When installing Boost 1.4.2, I made sure to "./bootstrap.sh --help" and see how to provide the correct Python path. My project-config.jam had the following line: using python : 2.6 : /home/aldebrn/sage/local ; Then of course PyCUDA wouldn't build. Here's the command I had to run: $ sage -python configure.py --boost-inc-dir=/home/aldebrn/pool/include --boost-lib-dir=$HOME/pool/lib --boost-python-libname=boost_python -- boost-thread-libname=boost_thread --cuda-root=/usr/local/cuda Note that boost_python and boost_thread were from my boost/lib directories. I also had to symlink libcuda.so from /usr/local/cuda/ lib64 to /usr/local/cuda/lib. Then I ran into this utterly absurd setuptools junk. I'll take my queue from Andreas' restraint and not complain bitterly like I want to. Anyway, after going into my sage/local/lib/python2.6/site-packages directory and $ rm setuptools* then going to my sage/local and deleting everything that $ find | grep easy_install revealed, I was able to build PyCUDA with "make install" and test it. It does complain about something, but it works: $ sage -python test_driver.py /home/aldebrn/sage/local/lib/python2.6/site-packages/pycuda-0.93-py2.6- linux-x86_64.egg/pycuda/compiler.py:11: UserWarning: call_capture_stdout is deprecated: use call_capture_output instead return call_capture_stdout([nvcc, "--version"]) -- Ran 16 tests in 4.719s OK Hope this helps some hapless soul. On Feb 20, 8:52 pm, SevenThunders wrote: > I posted this on the development list, but maybe I should have posted > here: > > I have an archlinux x86-64 desktop and I successfully installed > (compiled) sage. I'd like to add some additional functionality > however, but I've been stymied by a number of issues. First my top > issue is to get pycuda working with sage, which apparently others > have done. Unfortunately sage has an installation of setuptools which > doesn't work with pycuda, and is supposed to be somewhat deprecated as > of python 2.6.4. > > -- > I get an error of this type: > Does your error message look like this? > > "/usr/local/lib/python2.6/dist-packages/setuptools-0.6c9- > py2.6.egg/setuptools/command/build_ext.py", > line 85, in get_ext_filename > KeyError: '_something' > > You are using Python 2.6.3 with Setuptools. This will not work. > Uninstall setuptools, install > distribute.http://wiki.tiker.net/DistributeVsSetuptools#switching > --- > > Two other python libraries I could not install are PyQt4 and pygtk. > The latter runs up against an error: > -- > /usr/bin/ld: /opt/sage/sage/local/lib/../lib/ > libpython2.6.a(abstract.o): relocation R_X86_64_32 against > `.rodata.str1.8' can not be used when making a shared object; > recompile with -fPIC > /opt/sage/sage/local/lib/../lib/libpython2.6.a: could not read > symbols: Bad value > -- > > This prevents some other libraries from installing. > > I'm not sure why the sage python distribution is so persnickety. What > I'd like to know is how hard would it be to compile sage and configure > it to use Arch Linux's system python, rather than the sandboxed > python that comes with sage. This would make it much easier to > reliably use other python packages, though of course it doesn't > guarantee that sage would see a proven and tested environment, though > isn't version control and package dependencies supposed to mitigate > this issue? -- 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 URL: http://www.sagemath.org
[sage-support] Re: leastsq problem: array cannot be safely cast to required type.
Jose, I just tried this in a Notebook for a Sage having applied the patch as described in http://groups.google.com/group/sage-support/msg/00d0b4c724473e3c and it works: <<< import numpy as np from scipy.optimize import leastsq x = np.arange(0,3.0,0.25) y = np.array ([0.0,0.3066,1.2263,2.7591,4.9050,7.6641,11.0363,15.0216,19.6200,24.8316,30.6562,37.0941],dtype=float) # define a residuals function def residuals(p,x,y): k,degree = p err = y -(k*(x**degree)) return err # initial guess, k = 4.0, exp = 3? pinit = [4.0,3] #compute the leastsq algorithm leastsq(residuals,pinit,args=(x,y)) >>> produces: (array([ 4.90502425, 1.9494]), 3) See the thread for details, but for completeness, I am copying the relevant bit from wstein's mail: <<< sage: hg_sage.apply('http://trac.sagemath.org/sage_trac/attachment/ ticket/5081/5081-numpy-types.patch') sage: quit $ sage -br ... wait a few minutes >>> On Jul 27, 10:29 am, Jose Guzman wrote: > HI Minh Nguyen"! > > > > > I got this far: > > > -- > > | Sage Version 4.1, Release Date: 2009-07-09 | > > | Type notebook() for the GUI, and license() for information. | > > -- > > sage: import numpy as np > > sage: import scipy.optimize > > sage: x = np.arange(0, 3.0, 0.25) > > sage: y = np.array([0.0, 0.3066, 1.2263, 2.7591, 4.9050, 7.6641, > > 11.0363, 15.0216, 19.6200, 24.8316, 30.6562, 37.0941], dtype=float) > > sage: def residuals(p, x, y): > > : k, degree = p > > : err = y -(k*(x^degree)) > > : return err > > : > > sage: pinit = [4.0, 3] > > sage: scipy.optimize.leastsq(residuals, pinit, args=(x,y)) > > --- > > TypeError Traceback (most recent call last) > > > /home/mvngu/.sage/temp/sage.math.washington.edu/28595/_home_mvngu__sage_init_sage_0.py > > in () > > > /usr/local/sage/local/lib/python2.6/site-packages/scipy/optimize/minpack.pyc > > in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, > > gtol, maxfev, epsfcn, factor, diag, warning) > > 268 if (maxfev == 0): > > 269 maxfev = 200*(n+1) > > --> 270 retval = > > _minpack._lmdif(func,x0,args,full_output,ftol,xtol,gtol,maxfev,epsfcn,factor,diag) > > 271 else: > > 272 if col_deriv: > > > TypeError: array cannot be safely cast to required type > > > As mentioned at the thread > > >http://groups.google.com/group/sage-devel/browse_thread/thread/fd1414... > > > the problem is that at the moment there is little support for > > automatic data conversion between NumPy and Sage. Here are some > > tickets to make this happen: > > > #6497 > >http://trac.sagemath.org/sage_trac/ticket/6497 > > > #5081 > >http://trac.sagemath.org/sage_trac/ticket/5081 > > > #6506 > >http://trac.sagemath.org/sage_trac/ticket/6506 > > ok, I got it, I will have a look to that. I guess this might be a good > occasion to contribute to the Sage code. I will have a look to the > developers guide. --~--~-~--~~~---~--~~ 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: scipy binomial pmf
Jason, Robert, I'm trying to understand the patch, but it looks like this is a fix for *all* Numpy/Scipy-Sage type issues? If so---oh happy day! On Jul 9, 5:53 am, Jason Grout wrote: > Ahmed Fasih wrote: > > Writing your own is a good way to understand the implementation issues > > that we sometimes unthinkingly rely on, but for production code, it's > > always a good idea to default to the pre-packaged implementation. > > > In this case, I think it's the standard issue with Scipy not > > understanding Sage types. This problem is described in > >http://wiki.sagemath.org/faq#Typeissuesusingscipy.2Ccvxoptornumpyfrom... > > > sage: import scipy.stats as stats > > sage: stats.binom.pmf(1,10,.56,0) > > --- > > TypeError Traceback (most recent call > > last) > > > > TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and > > 'numpy.bool_' > > > There are numerous fixes to this problem, one of which is: > > > sage: stats.binom.pmf(1r,10r,.56r,0r) > > 0.0034614823012532187 > > Robert Bradshaw just posted a patch to #5081 that makes this work: > > sage: from scipy import stats > sage: stats.binom.pmf(1,10,.56,0) > 0.0034614823012532187 > > (no preparser magic or anything; it just works). > > And there was much rejoicing in the land! > > Jason --~--~-~--~~~---~--~~ 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: questions (complex function and Poncare sums)
Hi, I don't know what a modular group is but Python has some default support for complex numbers (e.g., you can type in 1+2j in just your standard Python interpreter and it will work), but all kinds of nice things are available in Sage: sage: z=1+2j sage: type(z) sage: C=ComplexField(256) sage: C Complex Field with 256 bits of precision sage: z2=C(1+2j) sage: z2 1.000 + 2.000*I sage: f = lambda z: z.imag()^2 # imag(z)^2 works as well sage: f(z2) 4.000 sage: f(z) 4.00 Also note that right now, mpmath (through the Sympy package) is included in Sage, which has additional support for complex analysis (I'm not totally sure what the overlap figure is): http://mpmath.googlecode.com/svn/trunk/doc/build/index.html sage: import sympy.mpmath as mp sage: z3=mp.mpc(1r+2rj) # the "r" suffix is needed for now to enforce raw mode since Mpmath as of now doesn't understand Sage types sage: mp.zeta(z3) mpc(real='0.59816556976238178', imag='-0.35185474521784527') On Jul 7, 4:15 pm, "crownea...@gmail.com" wrote: > 1. I would like to define a complex valued function > z -> f(z). For example f(z) = Im(z)^2. How do I define z so it is > represented as a complex float? > > 2. I would like to approximate a Poncare sum over the modular group. > Can you give me a reference for computing something like > > \sum_{\gamma \in \Gamma} f(z,\gamma(z)) > > Thanks --~--~-~--~~~---~--~~ 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: scipy binomial pmf
If you're calling Scipy functions from a standard Python environment, you won't have the pre-processor issues, so I may be misunderstanding what your underlying problem is. Assuming you are in Sage (since this is a Sage mailing list) and calling Scipy, other options that achieve the same effect as the raw suffix were detailed on the FAQ: cast the types to float() explicitly, turn off the pre-processor temporarily, redefine RealNumber() and Integer() to float() and int(), etc. etc. If none of these answer your question, please describe what you're trying to do and what errors you are getting. On Jul 6, 3:57 pm, Mikie wrote: > Ahmed, > > Looks good, but I am creating a function in python that is called. > And 1r, .56r ,etc. does not pass. I am taking these parameters from a > form and then using the function. > Is there a work-a-round? > Thanks > > On Jul 3, 6:19 pm, Ahmed Fasih wrote: > > > > > This is also an excellent resource: "How To Ask Questions The Smart > > Way," by the peerless Eric Steven > > Raymond:http://catb.org/esr/faqs/smart-questions.html > > > On Jul 3, 8:17 pm, Ahmed Fasih wrote: > > > > Writing your own is a good way to understand the implementation issues > > > that we sometimes unthinkingly rely on, but for production code, it's > > > always a good idea to default to the pre-packaged implementation. > > > > In this case, I think it's the standard issue with Scipy not > > > understanding Sage types. This problem is described > > > inhttp://wiki.sagemath.org/faq#Typeissuesusingscipy.2Ccvxoptornumpyfrom... > > > > sage: import scipy.stats as stats > > > sage: stats.binom.pmf(1,10,.56,0) > > > --- > > > TypeError Traceback (most recent call > > > last) > > > > > > TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and > > > 'numpy.bool_' > > > > There are numerous fixes to this problem, one of which is: > > > > sage: stats.binom.pmf(1r,10r,.56r,0r) > > > 0.0034614823012532187 > > > > As an alternative, if you plan on doing everything in Scipy/Numpy and > > > don't mind a fat-fisted approach, you may want to use IPython in Pylab > > > mode: start Sage with "sage -ipython -pylab" and you don't have to > > > worry about the preprocessor. > > > > On Jul 3, 3:30 pm, Mikie wrote: > > > > > I am trying to use the binomial pmf function in Scipy. Forget the > > > > question I will write my own. > > > > Thanx > > > > > On Jul 3, 9:32 am, William Stein wrote: > > > > > > On Fri, Jul 3, 2009 at 5:27 PM, Mikie > > > > > wrote: > > > > > > > What is the syntax to get the binomial function in Scipy to > > > > > > calculate? > > > > > > I have tried stats.binom.pmf(1,10,.56,0) etc. > > > > > > Thanks for the help. > > > > > > (1) I don't understand the question. What does your question mean? > > > > > > (2) Possibly you should also ask on the scipy support list, where > > > > > there are likely to be more scipy experts... > > > > > > -- > > > > > William Stein > > > > > Associate Professor of Mathematics > > > > > University of Washingtonhttp://wstein.org-Hide quoted text - > > > - Show quoted text - --~--~-~--~~~---~--~~ 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: a question about the plotting in sage
If you can give a minimal example generating X, Y, and Stress_Z in Sage or Numpy, we'll be in a better position to reproduce the Matlab output. Also, check these fine 3d plotting examples for Matplotlib: http://www.scipy.org/Cookbook/Matplotlib/mplot3D all the examples will work in Sage since sage includes Matplotlib. Also consider asking the Matplotlib community for assistance. On Jul 3, 7:12 am, wxuyec wrote: > As you said, I read the help about the list_plot3d. > It seems to be but not exactly what I want. > I want the value of the variable to be draw by > different colors, which the list_plot3d can't do. > > So can you give another favor? Thanks! > > On 7月3日, 下午6时26分, David Joyner wrote: > > > > > Maybe list_plot3d is what you want? Type "list_plot3d?" (without the > > quotes) at the prompt to see examples. > > > On Fri, Jul 3, 2009 at 6:03 AM, wxuyec wrote: > > > > I have some data from finite element calculating. I record > > > the value of a variable at every node of each element. > > > and I had plotted in matlab using the fellowing sentences: > > > fill(X,Y,Stress_z); > > > here the X and Y are the arrays of the x and y coordinates. > > > and the Stress_z is the value of the variable at nodes. > > > > I want to know whether there is a function or how to do > > > the same thing in Sage? > > > > Thanks a lot! --~--~-~--~~~---~--~~ 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: scipy binomial pmf
This is also an excellent resource: "How To Ask Questions The Smart Way," by the peerless Eric Steven Raymond: http://catb.org/esr/faqs/smart-questions.html On Jul 3, 8:17 pm, Ahmed Fasih wrote: > Writing your own is a good way to understand the implementation issues > that we sometimes unthinkingly rely on, but for production code, it's > always a good idea to default to the pre-packaged implementation. > > In this case, I think it's the standard issue with Scipy not > understanding Sage types. This problem is described > inhttp://wiki.sagemath.org/faq#Typeissuesusingscipy.2Ccvxoptornumpyfrom... > > sage: import scipy.stats as stats > sage: stats.binom.pmf(1,10,.56,0) > --- > TypeError Traceback (most recent call > last) > > TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and > 'numpy.bool_' > > There are numerous fixes to this problem, one of which is: > > sage: stats.binom.pmf(1r,10r,.56r,0r) > 0.0034614823012532187 > > As an alternative, if you plan on doing everything in Scipy/Numpy and > don't mind a fat-fisted approach, you may want to use IPython in Pylab > mode: start Sage with "sage -ipython -pylab" and you don't have to > worry about the preprocessor. > > On Jul 3, 3:30 pm, Mikie wrote: > > > > > I am trying to use the binomial pmf function in Scipy. Forget the > > question I will write my own. > > Thanx > > > On Jul 3, 9:32 am, William Stein wrote: > > > > On Fri, Jul 3, 2009 at 5:27 PM, Mikie wrote: > > > > > What is the syntax to get the binomial function in Scipy to calculate? > > > > I have tried stats.binom.pmf(1,10,.56,0) etc. > > > > Thanks for the help. > > > > (1) I don't understand the question. What does your question mean? > > > > (2) Possibly you should also ask on the scipy support list, where > > > there are likely to be more scipy experts... > > > > -- > > > William Stein > > > Associate Professor of Mathematics > > > University of Washingtonhttp://wstein.org --~--~-~--~~~---~--~~ 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: scipy binomial pmf
Writing your own is a good way to understand the implementation issues that we sometimes unthinkingly rely on, but for production code, it's always a good idea to default to the pre-packaged implementation. In this case, I think it's the standard issue with Scipy not understanding Sage types. This problem is described in http://wiki.sagemath.org/faq#Typeissuesusingscipy.2CcvxoptornumpyfromSage sage: import scipy.stats as stats sage: stats.binom.pmf(1,10,.56,0) --- TypeError Traceback (most recent call last) TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and 'numpy.bool_' There are numerous fixes to this problem, one of which is: sage: stats.binom.pmf(1r,10r,.56r,0r) 0.0034614823012532187 As an alternative, if you plan on doing everything in Scipy/Numpy and don't mind a fat-fisted approach, you may want to use IPython in Pylab mode: start Sage with "sage -ipython -pylab" and you don't have to worry about the preprocessor. On Jul 3, 3:30 pm, Mikie wrote: > I am trying to use the binomial pmf function in Scipy. Forget the > question I will write my own. > Thanx > > On Jul 3, 9:32 am, William Stein wrote: > > > > > On Fri, Jul 3, 2009 at 5:27 PM, Mikie wrote: > > > > What is the syntax to get the binomial function in Scipy to calculate? > > > I have tried stats.binom.pmf(1,10,.56,0) etc. > > > Thanks for the help. > > > (1) I don't understand the question. What does your question mean? > > > (2) Possibly you should also ask on the scipy support list, where > > there are likely to be more scipy experts... > > > -- > > William Stein > > Associate Professor of Mathematics > > University of Washingtonhttp://wstein.org --~--~-~--~~~---~--~~ 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: numpy.random
On Jun 29, 8:37 pm, Kevin Horton wrote: > It would be nice if that wiki FAQ mentioned the option of using an "r" > suffix. I didn't know about that possibility until now. > > I tried to set up a wiki account so I could edit the page, but that > didn't seem to work. Took the liberty of doing so (forgive me for any breach of protocol): http://wiki.sagemath.org/faq#Typeissuesusingscipy.2CcvxoptornumpyfromSage please feel free to edit as you see fit. --~--~-~--~~~---~--~~ 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: Notebook do not work
Adam, try posting your error message. On Jun 26, 10:20 am, adam mohamed wrote: > Dear All, > > I am having the same problem as the one below on a windows machine and I > tried: notebook(open_viewer=False) > in vain. What I should do? Thanks > Adam > > > > On Fri, Jun 26, 2009 at 2:06 PM, William Stein wrote: > > > On Fri, Jun 26, 2009 at 1:52 PM, Michael wrote: > > > > Hello i am just starting to work with SAGE and if I start it on the > > > commando line it starts without problem. But if i start notebook > > > (notebook()) from this enviroment it starts my Browser( "Konqueror") > > > follwoing happens: > > > Just do > > > notebook(open_viewer=False) > > > William > > > > In the sage enviroment: > > > sage: notebook() > > > The notebook files are stored in: /home/ich/.sage//sage_notebook > > > ** > > > * * > > > * Open your web browser tohttp://localhost:8000* > > > * * > > > ** > > > 2009-06-26 13:49:27+0200 [-] Log opened. > > > 2009-06-26 13:49:27+0200 [-] twistd 8.1.0 (/home/ich/SAGE/sage-4.0.2- > > > sage.math.washington.edu-x86_64-Linux/local/bin/python 2.5.4) starting > > > up > > > 2009-06-26 13:49:27+0200 [-] reactor class: > > 'twisted.internet.selectreactor.SelectReactor'> > > > 2009-06-26 13:49:27+0200 [-] twisted.web2.channel.http.HTTPFactory > > > starting on 8000 > > > 2009-06-26 13:49:27+0200 [-] Starting factory > > > > > > 2009-06-26 13:49:28+0200 [HTTPChannel,1,127.0.0.1] /home/ich/SAGE/ > > > sage-4.0.2-sage.math.washington.edu-x86_64-Linux/local/lib/python2.5/ > > > site-packages/twisted/internet/defer.py:267: > > > exceptions.DeprecationWarning: Don't pass strings (like 'Bad token') > > > to failure.Failure (replacing with a DefaultException). > > > 2009-06-26 13:49:28+0200 [HTTPChannel,1,127.0.0.1] Exception > > > rendering: > > > 2009-06-26 13:49:28+0200 [HTTPChannel,1,127.0.0.1] Unhandled Error > > > Traceback (most recent call last): > > > Failure: twisted.python.failure.DefaultException: Bad token > > > > on the Browser: > > > An error occurred rendering the requested page. More information is > > > available in the server log. > > > Internal Server Error > > > > I use SuSe Linux 11.1; > > > > Whats the Problem? > > > > I hope someone can help me! > > > > Michael > > > -- > > William Stein > > Associate Professor of Mathematics > > University of Washington > >http://wstein.org --~--~-~--~~~---~--~~ 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: numpy.random
Giovanni, try this instead: sage: numpy.random.multinomial(10, [.5,.5], size=20r) The only difference is the "r" suffix to the size argument. When you type in numbers into sage, the pre-processor converts them to a base ring, which you can see by doing: sage: preparse('numpy.random.multinomial(10, [.5,.5], size=20)') "numpy.random.multinomial(Integer(10), [RealNumber('.5'),RealNumber('. 5')], size=Integer(20))" Numpy support of these advanced sage types like Integer or RealNumber is spotty, so appending the "r" suffix (r for raw) to numbers prevents them from being preparsed. This is a sage thing, doesn't mean anything in regular python. Another way to accomplish this is to pass in "size=int(20)". Sometimes it's a matter of guessing which number isn't playing nice. There are a couple of things you can try: 1) If you are doing only Numpy stuff and don't need any sage-specific tools, you can use ipython without sage: "sage -ipython", or in the notebook, by either choosing "python" in the syntax drop-down menu instead of "sage", or by putting "%python" as the first line of cells. 2) Turn off the preprocessor before chunks of Numpy code: "preparse (False)". 3) Find out where in the numpy or sage code this error is happening and fix it. See Martin Albrecht's talk, '''How to get started developing Sage" at http://wiki.sagemath.org/days16 Best, Ahmed On Jun 26, 10:25 am, "giovanni.marche...@ds.unifi.it" wrote: > I would like to sample from a multinomial distribution. > > What's wrong in the following statements in sage 4.0.1? > > >>> import numpy.random > >>> numpy.random.multinomial(10, [.5,.5], size=20) > > Thank you > > -- Giovanni > > Traceback (click to the left for traceback) > ... > TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and > '' > > Traceback (most recent call last): > File "", line 1, in > File "/home/gmm/.sage/sage_notebook/worksheets/admin/41/code/ > 265.py", line 7, in > numpy.random.multinomial(_sage_const_10 , > [_sage_const_p5 ,_sage_const_p5 ], size=_sage_const_20 ) > File "/home/gmm/sage-4.0.1/local/lib/python2.5/site-packages/ > Jinja-1.2-py2.5-linux-x86_64.egg/", line 1, in > > File "mtrand.pyx", line 2655, in mtrand.RandomState.multinomial > File "element.pyx", line 729, in > sage.structure.element.ModuleElement.__add__ (sage/structure/element.c: > 6528) > File "coerce.pyx", line 740, in > sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/ > coerce.c:6584) > TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and > '' --~--~-~--~~~---~--~~ 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: DSage on Amazon EC2
As Sage continues to replace commercial and/or hand-rolled distributed numerical applications, this question becomes more and more important. I have neither EC2-specific nor general cloud-oriented comments---my use of Sage on a cluster was limited to very dumb file-based data- sharing. I'm hoping someone can describe a network-based task allocation method/code soon. I would greatly appreciate hearing about what you find with EC2. 20 cents per hour per dual-core 1.7 GB RAM node has applicability for our group's applications. On Apr 25, 2:26 pm, Andrzej Giniewicz wrote: > Hi, > > I just wonder - does anyone have experience on running DSage on Amazon > EC2 (on preferably more than one instance) or similar Cloud-Computing > service? I'm preparing to try out the platform but because of it's non- > zero cost I'd prefer not go in blind, would be very happy if someone > who did it already could share some or any informations about how it > runs there, with what optimizations, etc > > regards, > Andrzej. --~--~-~--~~~---~--~~ 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: Importing modules and packages from gobal python install
Flavio, I will defer to a more expert Sage user on importing global python libraries into Sage but I will offer my own experiences in installing libraries into Sage. Since Sage has a complete Python installation in it (accessible through "sage -python"), I have been able to install the few Python packages I needed directly into Sage (e.g., PyCUDA) by using "sage -python" instead of "python" in the installation instructions and explicitly giving the Sage root directory. If you give the names of the packages you're looking to use with Sage, I (or we) can try it on my machine. On Mar 16, 6:26 am, Flavio Coelho wrote: > Hi, > > I want to have sage let me import from my global python installation, > since I have packages installed there which are not available as sage > packages. Is this possible? > > thanks in advance, > > Flávio --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---