6

Im going to use sage module in my Django web application so in my python virtualenv v3.6 I installed sage using pip. when I run my script to use sage I get the following error:

  Exception Value: No module named 'sage.all'

I read some posts that sage has its own python. does it mean that I can not use sage in my python virtualenv?

Nima
  • 490
  • 2
  • 10
  • 19

3 Answers3

3

pip install sage installs a version 0.0.0 of a package that doesn't have any code inside, just an empty __init__.py. It's certainly not that sage you want to install. You have to find out which sage you really want. Do you mean SageMath?

phd
  • 82,685
  • 13
  • 120
  • 165
  • 2
    Yes I mean SageMath. – Nima Apr 26 '18 at 21:03
  • 1
    In that case, you definitely can't install it using pip; it's a VERY large and complex thing. You may wish to look at the [Sage legacy notebook](https://github.com/sagemath/sagenb) for a web app perhaps along the lines of what you are thinking. – kcrisman Aug 11 '18 at 01:54
  • @florian.isopp It's hardly new — I gave a pointer to doc.sagemath.org in my answer more than 2 year ago. – phd Dec 04 '20 at 23:01
  • 1
    @phd thats correct, haven't seen the links destination. Anyhow I m currently in the process of integrating sage into Windows to use it in python scripts. But I am still struggling with that.. – florian.isopp Dec 04 '20 at 23:19
  • Same here. Still struggling with Windows 10 latest updates and I really don't know why. In specific, I cant get it to be recognized from VS Code no matter what. I will be failing my assignment if I don't have it fixed until the 15th of July unfortunately. Should I try working on Ubuntu via a VM ? – Vaggelis Manousakis Jun 20 '21 at 22:08
1

SageMath can be installed from several package managers, including the standard package managers of several operating systems.

In particular, SageMath is packaged for Arch Linux, Conda, Debian, Fedora, Gentoo, Nix.

For more details see the "Distribution" page on the SageMath wiki.

The Sage library currently cannot be pip-installed. Work on that is tracked at:

Samuel Lelièvre
  • 3,212
  • 1
  • 14
  • 27
0

sage or sagemath is not available on PiPy. The packages installed during pip install sage and pip install sagemath are unrelated to sage and sagemath. You can install sagemath from apt:

sudo apt-get install sagemath

but it might not work with python environment like you expected.

However, you can install them with conda-forge.

conda config --add channels conda-forge
conda install sage

Alternatively, you can install sage using mamba.

conda install mamba
mamba install sage

For more information please refer to the GitHub repo of sage. I have added the instructions required for sage installation using PyPI.

zovelsanj
  • 23
  • 4