Ask Your Question

Andrew's profile - activity

2019-10-29 12:11:53 +0100 received badge  Great Question (source)
2017-09-20 06:21:31 +0100 received badge  Good Question (source)
2017-08-02 15:34:01 +0100 received badge  Famous Question (source)
2017-05-10 11:02:04 +0100 received badge  Notable Question (source)
2017-04-20 11:06:04 +0100 received badge  Popular Question (source)
2016-11-06 19:24:14 +0100 received badge  Nice Question (source)
2016-11-06 16:58:31 +0100 received badge  Student (source)
2016-11-06 16:48:19 +0100 asked a question Importing Python packages into Sage or Vice Versa

Hi all,

this is my first post. I'm a long time user of Python, and I'm fairly new to Sage. I'm using Ubuntu, if this helps. Currently, python doesn't recognize any of Sage's packages, and Sage can't import even standard Python packages like pandas.

I've looked at various instructions online about how to import sage packages into python and vice versa, but they all seem incredibly intricate, and none of them seem to work for me.

Here are a few attempts that I made:

  1. Running "sudo sagemath --python -m easy_install pandas" in terminal. (Still can't import pandas while running sage; even after running: "sys.path.append('/usr/lib/sagemath/local/lib/python2.7/site-packages/pandas-0.19.1-py2.7-linux-x86_64.egg')" from within sage.)
  2. Following the instructions in the "import sage packages in python" question. (I don't have enough karma to post links.)
  3. Doing various bizzarre attempts at changing sage_root or adding to it my python path.
  4. Attempting to import pip while running sage, and install pandas this way. (Can't import pip.)

I tried a few more things (like downloading packages and "build"ing them, and then doing a few more very technical and annoying things), and all of my attempts fail. Is there really no simple way to do this? What is the most fool-proof way to do this that exists? It would be enormously helpful for me to be able to use python packages while working in sage, or vice versa.