Installing Mathics¶
Here we describe the various ways to get Mathics installed.
What makes up Mathics?¶
Mathics is broken up into a number of pieces in order to facilitate using the parts of you desire. This can also reduce the vast number of dependencies to those that you need and the footprint to run. The pieces are described next with the component’s OS and Python-package dependencies.
Mathics Core¶
The Mathics core contains a scanner and parser, and evaluator, and some formatting routines. Over time, formatting routines may be packaged separately
There is also a very rudimentary command-line shell called mathics
.
The Mathics core required for any work with Mathics.
If you are developing a non-interactive application written in Mathics, you may no more than this.
Although we provide documentation on-line, should you want to build your own PDF, you’ll need to have various TeX packages installed.
mathicsscript¶
The Mathics core comes with a very rudimentary command-line shell, if you want fancier shell features such as:
- GNU Readline terminal interaction. This includes
saving command history between sessions.
variable completion, even for symbol names like \[Sigma]
limited ESC keyboard input; for example esc
p
esc is π
Syntax highlighting using pygments.
Automatic detection of light or dark terminal background color.
Entering and displaying Unicode symbols such as used for Pi or Rule arrows
there is a separately-installable PyPI package called mathicsscript
Django-based GUI¶
If you prefer, as many do, browser-based interaction with nicely formatted graphics and MathML-formatted output, right now there is a Django-based PyPI package Mathics-Django.
Some of its features:
Extensive online documentation and interactive documentation via Ajax
Integrated graphics and MathML mathematics output via MathJax
Notebook-like sessions
To use this, you will need Django 3.12 or later installed, and a browser with JavaScript enabled.
Note: in the future we intend to also proved a Jupyter-like interface.
Natural Language Python Module add-on¶
If you want Natural-Language processing, there is an additional PyPI package called pymathics-natlang.
To use this, you will need to have nltk and spacy installed.
Graph Python Module add-on¶
If you need to do work with Graph Theory or Networks you may want the Graph Python module called pymathics-graph.
To use this you will need to have networkx and matplotlib installed.
Install from PyPI¶
Here is how you can install the full Mathics suites:
$ pip install Mathics3 # this is the core engine
$ pip install Mathics-Django # web front-end
$ pip install mathicsscript # the command-line interface
$ pip install pymathics-natlang # the Natural-language Python module
$ pip install pymathics-graph # the Python module for working with Graphs and Networks
Note the name is “Mathics3” for the most recent release. “Mathics” has pre-Python 3 code.
See the previous sections for descriptions of the various pieces, what features they add and what dependencies are needed to run them.
Above we explicitly install Mathics3, the core, although that isn’t strictly necessary: if you install one of the other PyPI packages, it will pull in the Mathics3 core as a dependency.
Install from Conda-Forge¶
From docker (dockerhub)¶
As an alternative to building all the components from source or via Python package, you can run pre-built code for all of the components via docker. To download a copy of the docker image run:
$ docker pull mathicsorg/mathics
This will pull the latest development release that has a docker
tagname #latest
if you want a stable release, give the version in
the pull command. For example
$ docker pull mathicsorg/mathics#1.1.1
From an OS-specific Repository¶
Click on the link below from Repology.org for details for a specific OS and distribution:
Install from git from github¶
Requirements¶
Mathics runs on Python 3.6 or later. We also support PyPy 3.6 or later.
Underneath, Mathics relies on sympy which relies on numpy. These and the other requirements will be installed automatically if you use the standard Python installer pip. They are also listed in setup.py.
Several additional dependencies over what is described above if you want to:
build the documentation (which needs
xetex
, etc.)do full testing (which needs pytest, etc.)
run the command-line interface
run the Django 3.1 webserver (which needs SQLite, etc.) `
Below we give command-line instructions. There is also GitHub’s git client for your operating system (Mac; Windows). For that, clone mathics/Mathics (there is a button at the top of https://github.com/mathics/Mathics that says “Clone in Mac” or “Clone in Windows” depending on your platform).
$ git clone https://github.com/mathics/Mathics.git
$ cd Mathics
$ make install
$ cd ..
$ git clone https://github.com/Mathics3/mathics-django.git
$ cd mathics3-django
$ make install
$ cd ..
$ git clone https://github.com/Mathics3/mathicsscript.git
$ cd mathicsscript
$ make install
Alternatively use make develop
or pip install -e
to run the code
installed from where the source-code is checked out. In doing this, code
changes in the source tree are reflected immediately when you rerun.
Of course, you may not want this, but instead want to run from a copy of
the last stable code, so that’s what make install
does.
OS-dependent packages¶
For the installation above you may need OS-specific packages.
For Debian/Ubuntu based systems:
$ apt-get install python-dev libsqlite3-devp python-setuptools
as super-user, i.e. either after having issued su
or by preceding
the command with sudo
).
On Mac OS X:
$ brew install sqlite3
On FreeBSD:
$ sudo pkg install math/py-mathics