Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Be careful with your last statement: Sage is actually accessible as a python library with purely python syntax, but it also has an interface that supports weirder syntax like the one you mentioned.


Do you know how to install the library in a Python environment?


In one sense, what you want is possible but not currently supported, though people are working on it (https://trac.sagemath.org/ticket/29705 is a good start). In another sense, the SageMath install is just a Python environment. When you install Sage (from source or a binary) you are install a Python environment, similar to Anaconda. You can then type "sage -sh" to setup the environment, then install packages (pip3 install), or run a Python interpreter (by typing "python3") and do "import sage.all" to get the full sage library as a normal Python library. You could write a Python program and use any of Sage in them by importing "sage.all" in your Python program.

The reason Sage is currently distributed this way is similar to the reason Anaconda exists, which is that Python's package manager isn't (or wasn't in 2005 when I started this!) meant to build something as complicated as Sage, which has about 100 complicated dependencies. I really hope this eventually changes someday and people can type "pip install sagemath" and get something useful.

Oh, I think for several Linux distributions there are SageMath packages that just build Sage into the standard system-wide Python. So if you're using Linux, the problem may already be solved for you.


I think it's unlikely that pip will be able to easily install something like Sage anytime soon, but one could use conda [1] which is pretty popular in the scientific community, or alternatively docker [2]. It also seems there's support in the Nix package manager [3] which is actually more powerful than any other package manager I'm aware of (GUIX notwithstanding).

(I realize that this response is probably useless for the Sage author, but hopefully will benefit others who struggle with installation)

[1] https://doc.sagemath.org/html/en/installation/conda.html#sec... [2] https://hub.docker.com/r/sagemath/sagemath/ [3] https://github.com/NixOS/nixpkgs/blob/master/pkgs/applicatio...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: