Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use sagemath on python?

Tags:

python

sage

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?

like image 505
nemy Avatar asked Aug 13 '26 10:08

nemy


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:

  • Ask Sage question 39742: Make PyCharm recognise the Sage Python interpreter on Windows
like image 185
Samuel Lelièvre Avatar answered Aug 18 '26 02:08

Samuel Lelièvre