Ask Your Question

Sagemath for Windows: a giant headache

asked 2019-09-03 06:42:09 +0200

droberts01 gravatar image

updated 2019-09-03 08:42:05 +0200

Hi everyone,

I've encountered two serious issues when trying to use Sagemath on Windows:

1) It is incompatible with any package that requires Anaconda for installation (e.g. QuTiP, etc..)

2) It is incompatible with popular commercial-grade Python IDE's (e.g. PyCharm will not recognize the Sage interpreter)

The reason why this is specific to Windows is because, on Mac, Sage can be installed through Anaconda (see ( for details), thus circumventing the above issues. So everything works like a dream on Mac OS X. Here are my questions:

1) Why is there such a disparity between the Windows and Mac situations?

2) Can we expect Anaconda support anytime soon? Or is it a waste of time refreshing the sagemath section of the (conda-forge) site from time to time?

If anyone knows how any of these issues might be resolved (possibly by not needing to use Anaconda), please let me know! In any case, if I can't resolve these issues, then I am most likely going to revert to using Mathematica, which is sad, because I like how Sage is designed.

edit retag flag offensive close merge delete



If you have about 2 to 3 years' worth of funding available for a full time developer I can make Sage installable in anaconda on Windows :) Maybe that would be a better use of your money than that Mathematica license but I don't know!

Iguananaut gravatar imageIguananaut ( 2019-09-04 12:33:03 +0200 )edit

Haha PhD candidate here, definitely will fund, maybe later in my career though!

droberts01 gravatar imagedroberts01 ( 2019-09-05 01:02:25 +0200 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2019-09-03 08:57:00 +0200

vdelecroix gravatar image

updated 2019-09-03 08:59:39 +0200

As far as I understand, SageMath will not be packaged anytime soon for Windows in Conda because SageMath does not work on Windows. Windows does not follow POSIX conventions for threads and signals. This prevent many dependencies of SageMath to not compile at all on Windows. If Windows happen to switch to a POSIX compatible environment it will be a matter of days to get SageMath ported to Windows! Concretely, the miracle that makes SageMath currently "runs" on Windows is Cygwin. It is a thin layer that performs the necessary translations. The drawback is that SageMath uses its own version of Python which is installed inside Cygwin. In particular, you don't have access to Python libraries that would be installed by other means on the system. This is very unfortunate. Though, you can still install Python libraries in the Cygwin enviromnement (using the Python package manager pip).

For question number 2), it should be possible to tweak the configuration of PyCharm to actually make it accept the Cygwin python... I am not familiar enough with PyCharm to make a more precise answer.

edit flag offensive delete link more



Configuring PyCharm on Windows to use Sage:

Iguananaut gravatar imageIguananaut ( 2019-09-04 12:42:31 +0200 )edit

answered 2019-09-04 12:35:45 +0200

Iguananaut gravatar image

updated 2019-09-04 12:57:12 +0200

Piggy-backing on @vdelecroix's answer, I wrote a whole little tutorial on using Sage from PyCharm here:

I believe due to some recent changes in Sage its now even easier than that and requires setting fewer environment variables, but I'm not positive. Haven't tested it in a while.

Second, as (former; haven't needed it in a while) user of QuTiP, anaconda is not required to install it. You can pip install it into Sage's Python by running

$ pip install 'qutip<4.4.0'

(slight update: it appears QuTiP has at some point ceased continuous integration on Python 2 and have been letting Python 2 support break, despite not announcing anywhere a plan to cease Python 2 support, so it turned out the latest version contains Python 3-only syntax and is broken on Python 2; Sage 9.0 when it's released, will likely be the first to claim support for Python 3, and there will likely be a Python 3 Windows build as well.)

in the Sage shell. All of its dependencies are already included in Sage.

It does suck having to have two copies, and that Sage currently requires its own Python interpreter. But that's something that could be improved if more of Sage's dependencies were ported to native Windows (or if Anaconda added official support for packages built with Cygwin support; ask them they have millions of dollars in DoD funding).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-09-03 06:39:39 +0200

Seen: 1,802 times

Last updated: Sep 04 '19