ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 02 Apr 2019 15:56:46 -0500Is it possible to update the Sage Python?http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/ I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?cybervigilanteWed, 05 Apr 2017 16:13:53 -0500http://ask.sagemath.org/question/37181/Is it possible to run (may be partially) Sage with Python 3?http://ask.sagemath.org/question/33887/is-it-possible-to-run-may-be-partially-sage-with-python-3/ I want to run sage with python3. I know that it isn't fully ported, but I want to use already ported functionality and hope it cover my needs.
One particular reason is my necessity to use `multiprocessing.pool` with `lambda` function which doesn't work with python 2 and [both workarounds](http://stackoverflow.com/questions/4827432/how-to-let-pool-map-take-a-lambda-function ) seem to not work also.
P.S. I found [third workaround](http://stackoverflow.com/a/37976180/359866) which seems to be working.petRUShkaWed, 22 Jun 2016 12:52:59 -0500http://ask.sagemath.org/question/33887/"print" statement vs function for Sage-py3http://ask.sagemath.org/question/45994/print-statement-vs-function-for-sage-py3/With the upcoming migration of Sage from Python2 to Python3, I was wondering if Sage's default new behavior will be the current `print` statement (e.g., `print 'hello'`) or will it change to Python3's `print` command (e.g., `print('hello')`).
In case of a change from the current behavior, will there be a way to keep backwards compatibility for code written Python2-style?
Thanks for your answers!dsejasTue, 02 Apr 2019 15:56:46 -0500http://ask.sagemath.org/question/45994/Is it possible to use python3?http://ask.sagemath.org/question/36088/is-it-possible-to-use-python3/I just learnt python3.
But i came to know after installing sage that it use python2?
Do I have a future in sage?
I don't prefer to use the cloud, but the package i have?
>What should I do now? screened00Sun, 25 Dec 2016 12:41:13 -0600http://ask.sagemath.org/question/36088/How to implement "positional-only parameter" in a user defined function?http://ask.sagemath.org/question/43959/how-to-implement-positional-only-parameter-in-a-user-defined-function/def fun( a, b, /):
print(a,b)
o/p:
File "<ipython-input-36-1fceb840aeb9>", line 1
def fun( a, b, /):
^
SyntaxError: invalid syntaxdamodarTue, 16 Oct 2018 04:23:40 -0500http://ask.sagemath.org/question/43959/Is there any difference between the variables b and *b in these two statements? If so, what is it?http://ask.sagemath.org/question/43966/is-there-any-difference-between-the-variables-b-and-b-in-these-two-statements-if-so-what-is-it/
(a, b, c) = 1, 2, 3
(a, *b, c) = 1, 2, 3damodarTue, 16 Oct 2018 08:54:43 -0500http://ask.sagemath.org/question/43966/list as a function parameter.http://ask.sagemath.org/question/43939/list-as-a-function-parameter/.
>>> def fun(x, b= []):
... b.append(x)
... print(x,' ',b)
...
>>> fun(7)
7 [7]
>>> fun([9, 7])
[9, 7] [7, [9, 7]]
>>> fun([9, 8])
[9, 8] [7, [9, 7], [9, 8]]
>>>damodarSat, 13 Oct 2018 17:25:51 -0500http://ask.sagemath.org/question/43939/How to call nested tuple and nested set or dictionary using variable argument and variable keyword argument methods ?http://ask.sagemath.org/question/43921/how-to-call-nested-tuple-and-nested-set-or-dictionary-using-variable-argument-and-variable-keyword-argument-methods/.
def arithmetic_mean(first, *values):
""" This function calculates the arithmetic mean of a non-empty
arbitrary number of numerical values """
return (first + sum(values)) / (1 + len(values))
x= [('a', 232), ('b', 343), ('c', 543), ('d', 23)]
y= [[('a', 232), ('b', 343), ('c', 543), ('d', 23)]]
how to pass x and y inside arithmetic_mean.
can it be possible through zip method?damodarThu, 11 Oct 2018 13:16:34 -0500http://ask.sagemath.org/question/43921/Python3 MigrationStatushttp://ask.sagemath.org/question/43848/python3-migrationstatus/Hello. I looked at Trac , but I couldn't make out just how far we are into migrating to python3. Looks to me that most issues are closed by now. I'd appreciate quick summary from a sage developer.rijndaelxyzSat, 06 Oct 2018 15:38:40 -0500http://ask.sagemath.org/question/43848/make ptest fails after compilation based on Python3http://ask.sagemath.org/question/42924/make-ptest-fails-after-compilation-based-on-python3/I installed sagemath 8.3rc0 on my fedora 28 linux x86_64 system using the following commands:
make configure
./configure --prefix=$HOME/sage --with-python=3 --with-mp=gmp
make build
This seemed to have installed sage successfully but when I run tests with:
$ make ptest
I get the following errors and make ptest fails:
[manifolds] from Queue import Queue
[manifolds] ModuleNotFoundError: No module named 'Queue'
OSError: [manifolds] /home/user/sagemath/inst/lib/python3.6/site-packages/sage/manifolds/differentiable/curve.py:docstring of sage.manifolds.differentiable.curve.DifferentiableCurve:58: WARNING: Exception occurred in plotting curve-1
[dochtml] [manifolds] dumping object inventory... done
[dochtml] [manifolds] build succeeded.
[dochtml] [manifolds] The HTML pages are in ../inst/share/doc/sage/inventory/en/reference/manifolds.
[dochtml] Error building the documentation.
Error building Sage.
The following package(s) may have failed to build (not necessarily
during this run of 'make all-start'):
* documentation: dochtml
log file: /home/user/sagemath/src/logs/pkgs/../dochtml.log
The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.
make[1]: *** [Makefile:33: all-start] Error 1
make[1]: Leaving directory '/home/user/sagemath/src'
make: *** [Makefile:13: all] Error 2
I believe one of the `OSError` or the `dochtml` error is causing `make ptest` to fail. Can I get advice on how I can correct these problems?number123Wed, 11 Jul 2018 10:19:16 -0500http://ask.sagemath.org/question/42924/Performance Upgrades With Python3?http://ask.sagemath.org/question/42945/performance-upgrades-with-python3/Are there any? o6pThu, 12 Jul 2018 05:07:07 -0500http://ask.sagemath.org/question/42945/Differences between Python2 Sagemath and Python3 Sagemath?http://ask.sagemath.org/question/42932/differences-between-python2-sagemath-and-python3-sagemath/ With sagemath looking to move away from python2 in 2020 and as a new user of sagemath, I wanted to know what the differences are between Python2 Sagemath and Python3 Sagemath?
At the moment sagemath is not fully compatible with python3 and I have been told to expect problems. I want to know how serious these problems are and how frequent they are. I would then be able to know if using python3 sagemath is worth the trouble.number123Wed, 11 Jul 2018 14:35:20 -0500http://ask.sagemath.org/question/42932/Python 3 print in Sagehttp://ask.sagemath.org/question/38805/python-3-print-in-sage/ This is a minor issue, but I've long migrated all my Python scripts to Py3, so I'm trying to write in Sage in the most Py3-compliant way possible, since we'll have Py3 support in a not-so-distant future according to the FAQs (frankly I'm a bit surprised that Py3 support haven't already happened, but, oh well).
Anyway, because of that I put `from __future__ import print_function, division` in the very first line of my `init.sage`.
If I type things interactively in the prompt, it works as it's supposed to:
sage: print('C_r' ,6)
C_r 6
However, if I run a script with `load('my_script.sage')` it prints things as if I was using Py2.
('C_r', 6)
Am I loading my scripts wrong? How can I get it to work for scripts too?
Cheers.tomchoTue, 12 Sep 2017 11:40:04 -0500http://ask.sagemath.org/question/38805/Using a python 3 class in SageMathhttp://ask.sagemath.org/question/35564/using-a-python-3-class-in-sagemath/I wrote a class that uses some python 3 features (specifically, functools.lru_cache).
When I try to import it into my SageMath notebook, I get errors, since the notebook runs on Python 2.7.
I read in this FAQ: http://doc.sagemath.org/html/en/faq/faq-usage.html
that the answer to the question "Can I use Sage with Python 3.x?"
is: "Currently, no. Sage depends on the SciPy stack of Python numerical and scientific packages. As of 2010, SciPy still uses Python 2.x. So until SciPy is ported to run with Python 3.x and Cython supports Python 3.x, Sage will continue to use Python 2.x."
But, this answer is from 2010. Now it's 2016, and SciPy already supports Python 3.
So, my questions are:
* Is it possible now to use SageMath with Python 3
* If not, is there a workaround I can use to import my class to SageMath notebook?Erel Segal-HaleviMon, 14 Nov 2016 03:41:16 -0600http://ask.sagemath.org/question/35564/Running python on sagehttp://ask.sagemath.org/question/24461/running-python-on-sage/I understand that python interfaces with sage but why do some people run a python module on sage? Is it because of memory reasons, graphical availability, etc?
Thanks.
Mee Seong ImSat, 11 Oct 2014 10:42:42 -0500http://ask.sagemath.org/question/24461/Python compiler in Sage Notebookhttp://ask.sagemath.org/question/9298/python-compiler-in-sage-notebook/Do you know which version of Python has been providing in Sage Notebook?FastfootWed, 05 Sep 2012 11:02:26 -0500http://ask.sagemath.org/question/9298/python 3.xhttp://ask.sagemath.org/question/8926/python-3x/I read previously that Sage would support python 3 when SciPy and Cython worked with 3.x. Since both SciPy and Cython now both support 3.x is Sage also now compatible? I am waiting to use Sage until it works with Python3.kramer11xWed, 25 Apr 2012 08:07:42 -0500http://ask.sagemath.org/question/8926/Support for python 3? (yes, I've read the FAQ)http://ask.sagemath.org/question/8430/support-for-python-3-yes-ive-read-the-faq/According to Sage's FAQ:
http://www.sagemath.org/doc/faq/faq-usage.html#can-i-use-sage-with-python-3-x
"Until SciPy is ported to run with Python 3.x and Cython supports Python 3.x, Sage will continue to use Python 2.x"
Scipy has been ported to Python 3.x, and Cython already works with Python 3.x. Are there any plans to port Sage to Python 3.x?
oscarvartoWed, 02 Nov 2011 13:39:09 -0500http://ask.sagemath.org/question/8430/