How to use sagemath on python?

Viewed 3204

I would like to use cubegroup of sagemath. I did as follows.

python -m pip install sagemath

and then

import sagemath.cubegroup;

in python script. But I got the following error.

ImportError: No module named cubegroup

I tried both python2 and python3 but neither worked. I also tried sage instead of sagemath, but didn't work either.

How can I use sagemath and cubegroup on python?

1 Answers

The sagemath package on PyPI, which you get by running

python -m pip install sagemath

does not install Sage, it only allows to check whether Sage is installed.

It seems you are working on Windows and you installed Sage using the Sage-Windows installer.

The command

import sage.cubegroup

will work only if you use Sage's Python.

If you are using Python via some integrated development environment such as PyCharm, you need to set it up to use Sage's Python. See instructions in Iguananaut's answer to:

Related