Ask Your Question

Revision history [back]

Run the sage shell by typing sage -sh in a terminal.

In the sage shell, run pip install pandas.

Next time you launch Sage, you can import pandas.

Before:

$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 7.4, Release Date: 2016-10-18                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: import pandas
Traceback (most recent call last)
...
ImportError: No module named pandas
sage:

Installing:

$ sage -sh

Starting subshell with Sage environment variables set.  Don't forget
to exit when you are done.  Beware:
 * Do not do anything with other copies of Sage on your system.
 * Do not use this for installing Sage packages using "sage -i" or for
   running "make" at Sage's root directory.  These should be done
   outside the Sage shell.

Bypassing shell configuration files...

Note: SAGE_ROOT=/opt/s/sage-7.4
(sage-sh) you@YourComputer:~$ pip install pandas
Collecting pandas
  Downloading pandas-0.19.1.tar.gz (8.4MB)
    100% |████████████████████████████████| 8.4MB 116kB/s 
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /opt/s/sage-7.4/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /opt/s/sage-7.4/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /opt/s/sage-7.4/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /opt/s/sage-7.4/local/lib/python2.7/site-packages (from python-dateutil->pandas)
Installing collected packages: pandas
  Running setup.py install for pandas ... done
Successfully installed pandas-0.19.1
You are using pip version 8.1.2, however version 9.0.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(sage-sh) you@YourComputer:~$

After:

$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 7.4, Release Date: 2016-10-18                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: import pandas
sage: