IPython, Sage, Dependencies, Anaconda and package integration?

I just started using IPython for interactive research and development, which I found very interesting with all the interesting features and capabilities. I am using Anaconda's package manager for dependency management, including IPython.

From what I read, one goal of the IPython team is to ultimately integrate Sage Math (CAS) into IPython as cell magic. Does anyone know if this is still under development? Or rather, if I wanted to use Sage now, writes the extension, the only way to do this [1]?

[1] https://github.com/ipython/ipython/wiki/Extensions-Index

In addition, if I install additional packages for scientific development that are not included in the Anaconda distribution, is it as simple as piping or should I go through the Anaconda build to handle dependencies, etc.? If I were only using IPython, I could understand how easy it is to do easy_install or pip as recommended in the docs, but I believe that it overwrites existing dependencies in Anaconda. If I use pip, how does this affect Anaconda dependencies, if I do not install in the Anaconda environment that I accept, is it the equivalent of virtualenv.py, and is this also a way to configure version control (i.e. Mercurial)?

To clarify, I do not want to start IPython from Sage, I want to start Sage, like CAS, from IPython. I would rather use the Sage approach for integrating domain languages. Or vice versa, will IPython extensions replace Sage?

I am a self-learning programmer, not a professional software developer. As an engineer, I’m used to Matlab, Mathematica and commercial solutions that allow me to disengage from the plumbing. I'm trying to think about how everything sticks together, but it looks like a mixture of spaghetti soup and a dynamic link library due to lack of knowledge. Maybe I'm using the wrong approach.

What I want is Anaconda / Enthought package management (IPython, pandas, etc.), customizable Sage via hooks / extensions or magic, extensions to packages not included in Anaconda (ie Matlab see [1 ]), and version control using Git and Mercurial. How did professional developers install this on Mac or Linux?

+4
source share
4 answers

Answering the first question:

Sage is a huge collection of math software, including IPython. We could not integrate all this into IPython.

You may have heard that we are going to integrate Sage style “interoperability” into IPython. That you have a slider to control the value of any input variable, and output updates when moving around it based on a calculation written in Python. It is still in our roadmap to add to IPython.

Another possibility is what you think of SymPy , a Python-based CAS. SymPy works well in IPython, especially if you call sympy.init_printing() to get fancy expressions.

+4
source

I wrote an IPython extension to load Sage settings into IPython notepad - in fact, how many settings for IPython are done for the normal Sage interface. This basically turns the IPython laptop into an interface to Sage (e.g. getting ready, etc.).

However, you need to run it from a copy of Sage IPython. Just start your IPython laptop:

 sage -ipython notebook 

and then load the sage extension into the cell:

 %load_ext sage.misc.sage_extension 

Pretty soon, we'll move on to IPython 1.0 (I made the necessary changes and need to be reviewed). If you want to run IPython 1.0 already, write a sage support mailing list and send instructions.

To answer your other question, Sage includes many packages that are not available in Anaconda. Sage is heavily dependent on these packages for many features. I suppose there is an opportunity to get Sage and its dependencies distributed with something like Anaconda, but no one is working on this as far as I know. There is some work on Sage packaging for various Linux distributions and a replacement package manager for Sage.

+4
source

To clarify, I do not want to run Ipython from Sage, I want to run Sage, like CAS, from Ipython. I would rather use the Sage approach for integrating domain languages. Or, conversely, will Ipython extensions replace Sage?

If you want to run Sage in Ipython, the easiest way is to use a Sage copy of Ipython:

 $ sage -ipython Python 2.7.5 (default, Aug 1 2013, 18:11:00) Type "copyright", "credits" or "license" for more information. IPython 0.13.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython features. %quickref -> Quick reference. help -> Python own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: from sage.all import * In [2]: integrate(x^2,x) --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-2-006357f5d9c0> in <module>() ----> 1 integrate(x^2,x) NameError: name 'x' is not defined In [3]: var('x') Out[3]: x In [4]: integrate(x^2,x) --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-4-006357f5d9c0> in <module>() ----> 1 integrate(x^2,x) /Users/.../sage-5.11.rc0/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.Element.__xor__ (sage/structure/element.c:6754)() RuntimeError: Use ** for exponentiation, not '^', which means xor in Python, and has the wrong precedence. In [5]: integrate(x**2,x) Out[5]: 1/3*x^3 

Note that there are some differences between this and Sage - for example, there is no syntax preparation. Presumably if you had Sage somewhere where your own Ipython installation can find it, you can do it there too (although there is no easy_install , and Python versions may not match correctly!).

+1
source

Please note that Sage, as it is currently and should be in the near future, is a huge package that works only on POSIX (Linux-like). If you intend to run it on Windows, you should use VirtualBox with Sage running under the VM.

If you want a simple CAS that is easy to install and works everywhere that Python does, you should consider browsing Sympy . It does not interact with all the software that Sage does, but is easy to use, lightweight (does not require external libraries) and already included in the base Anaconda distribution.

In addition, it can be easily used inside other Python programs, since it is just like any other module and does not make changes to the Python syntax.

0
source

Source: https://habr.com/ru/post/1498670/


All Articles