Integrating SageMath into existing Python install / Python compiling error

438 views
Skip to first unread message

Jordan Argyle

unread,
Apr 10, 2018, 1:24:41 PM4/10/18
to sage-devel
My immediate issue is that I tried to compile SageMath from the Github (git clone https://github.com/sagemath/sage.git), and it broke trying to compile Python. Logs are attached. Note that I tried to build python 3 times, so there's a little repeat at the end of the logs.

However, my ultimate goal is to set up a multi-dev box. Basically, I want to create a single Anaconda/Jupyter install that has some 15 kernels in it, including SageMath. I'm somewhat knew to building code and such, but I'm not completely at ground zero. While help fixing the python problem would be appreciated, I would rather have some help thinking through how to compile SageMath and hook it up to my existing Anaconda install...and how to create a Python environment for it! I already have several other codes with their own environments built (special-use software stuff), and I'd like to avoid having multiple python instances running. I did find this, but that's not really the solution I'm hoping for.

I'm running Ubuntu on a VM, giving it 4 GB of RAM and 4 cores. If you need any more info, let me know. I know this has come up a few times in forums and things. I'm willing to write out the instructions for how I got it going and post them here to be put on the various forums/instructions/web sites/etc, but I need some help from people much better at computers than I. Thank you!
install.log
python2-2.7.14.p2.log

Erik Bray

unread,
Apr 10, 2018, 2:10:36 PM4/10/18
to sage-devel
Hi Jordan,

First of all, on the conda stuff, there is already an (still
"experimental" I think) Sage package for conda. See

https://wiki.sagemath.org/Conda
https://github.com/conda-forge/sage-feedstock

I'm not exactly sure how that fits in with your vision, but most
likely if you want to use Sage in Anaconda, playing with that and also
seeing what work is needed for it would be the place to start. As it
is you can also create a Jupyter kernel that runs a Sage installation
that's separate from the Python installation that Jupyter is running
in--this has already been done before. But the way
Sage-the-distribution works it doesn't otherwise make sense to somehow
"hook" Sage into a different Python installation. It's just asking
for trouble. So I would look into the Sage package for conda.

As for your Python build issue I'm not sure. It looks like it's
failing on a flag being passed to your gcc: "-fp-model strict".
That's an option for Intel Compiler and is not recognized from gcc.
I'm not sure where that came from unless it came from your environment
somehow. Sage doesn't support compiling with ICC AFAIK.

Best,
E

Jordan Argyle

unread,
Apr 12, 2018, 1:41:58 PM4/12/18
to sage-devel
That makes sense--thank you! I think the Intel Compiler flag comes from the fact that I have a customized compiler through a program called MOOSE, and they all dev on macs, so the compiler may be trying to use their settings.

I was introduced to Sage through the VirtualBox appliance available online (http://www.cecm.sfu.ca/sage/ova/index.html). I wanted to recreate that, but fix the problems with LaTeX (so that I can export a PDF, for example). I have been hacking in the terminal of that VirtualBox for a while to try to adjust LaTeX installs, add additional kernels, etc, but have found it too messy and difficult. So, I have been following the more "standard" install procedures for Jupyter installed through Conda, and hoped I could attach Sage that way.

With that in mind, what would you recommend for me to try first? Is the best way to do this the conda package? Would that be connected to my global LaTeX install? Or should I just install the binaries, and connect it to my Jupyter install al la this link...I'm not sure how to replicate the install in the OVA, and I'm not sure of the best way to approach this, which is why I asked here. Any additional thoughts would be appreciated!

Erik Bray

unread,
Apr 13, 2018, 9:02:31 AM4/13/18
to sage-devel
On Thu, Apr 12, 2018 at 7:41 PM, Jordan Argyle <jorda...@gmail.com> wrote:
> That makes sense--thank you! I think the Intel Compiler flag comes from the
> fact that I have a customized compiler through a program called MOOSE, and
> they all dev on macs, so the compiler may be trying to use their settings.
>
> I was introduced to Sage through the VirtualBox appliance available online
> (http://www.cecm.sfu.ca/sage/ova/index.html). I wanted to recreate that, but
> fix the problems with LaTeX (so that I can export a PDF, for example). I
> have been hacking in the terminal of that VirtualBox for a while to try to
> adjust LaTeX installs, add additional kernels, etc, but have found it too
> messy and difficult. So, I have been following the more "standard" install
> procedures for Jupyter installed through Conda, and hoped I could attach
> Sage that way.

I mean, there are also binary builds of Sage for Linux, OSX, and
Windows (via Cygwin), so you may be able to install any one of them
depending on your platform; e.g.
http://doc.sagemath.org/html/en/installation/binary.html
(incidentally the section on there for Windows is outdated--I need to
fix that).

There was an official Debian package for Sage that was mostly working,
but there hasn't been regular-enough maintenance on it to keep it
working, something some of us are hoping to fix sometime...

There's no reason necessarily to install Jupyter in a conda
environment either--that's not necessarily any more "standard" than
using your system's package installer--that said it's probably the
best way to install the most recent Jupyter in a way that's consistent
across platforms. If you wanted to install Sage in conda the best way
would be to use the existing conda package for Sage and, if there are
problems with that, to report those problems and keep things focused
on maintaining the existing conda porting effort.

> With that in mind, what would you recommend for me to try first? Is the best
> way to do this the conda package? Would that be connected to my global LaTeX
> install? Or should I just install the binaries, and connect it to my Jupyter
> install al la this link...I'm not sure how to replicate the install in the
> OVA, and I'm not sure of the best way to approach this, which is why I asked
> here. Any additional thoughts would be appreciated!

I'm not exactly sure what blocker is--you seem to be talking about two
issues: Using the Sage kernel in Jupyter, and using an existing LaTeX
distribution with Sage. Both are certainly possible. For the LaTeX
installation it should work so long as the relevant executables such
as pdflatex and maybe dvi2png and such can be located on the $PATH. I
feel like somewhere there must be better existing documentation on
exactly what the requirements are. Somebody else might know better.

Thierry

unread,
Apr 14, 2018, 5:29:47 AM4/14/18
to sage-...@googlegroups.com
Hi,

On Fri, Apr 13, 2018 at 03:02:24PM +0200, Erik Bray wrote:
[...]
> There was an official Debian package for Sage that was mostly working,
> but there hasn't been regular-enough maintenance on it to keep it
> working, something some of us are hoping to fix sometime...

You might have missed a part of the history: there *is* a Debian package
for Sage, now in stable, see

https://packages.debian.org/stretch/sagemath

Ciao,
Thierry

Jordan Argyle

unread,
Apr 14, 2018, 9:16:07 AM4/14/18
to sage-devel
I will have to look into the debian package! I got my Sage to compile--I had to remove some things from my .bashrc that I added to make sure MOOSE would work. Should anybody be in this (very particular) situation in the future, the lines to comment out are:
export CC=mpicc
export CXX=mpicxx
export F77=mpif77
export FC=mpif90
export PATH=$GCC_HOME/bin:$MPI_HOME/bin:$PATH

I have gotten LaTeX and Sage to play nicely together, as well. The only issue I still have is that when I go to print my notebook file (File->Download file as->PDF via LaTeX) I don't get a pretty PDF. I'll start a new thread about that.

Thank you both for your thoughts and help!

Samuel Lelievre

unread,
Apr 14, 2018, 12:33:56 PM4/14/18
to sage-devel
Sat 2018-04-14 09:29:47 UTC, Thierry:
One can install the Debian-packaged SageMath with

     apt install sagemath-jupyter

...not sure why it is not simply

    apt install sagemath
 

Jan Groenewald

unread,
Apr 14, 2018, 12:41:00 PM4/14/18
to sage-devel
I think the package sagemath is the shell only, no notebooks.

--
  .~.
  /V\     Jan Groenewald
 /( )\    www.aims.ac.za
 ^^-^^ 

Jordan Argyle

unread,
Apr 14, 2018, 1:53:30 PM4/14/18
to sage-devel
Which is perfect if one already has Jupyter. The Jupyter definition can be obtained from the source code/github and attached as I stated before. I noted that the Debian package is v. 7.something, not 8.1. Any plans to update that?

Jordan Argyle

unread,
Apr 14, 2018, 2:07:36 PM4/14/18
to sage-devel
So, I shut down my linux box after getting it to work, and then on restart, I can no longer connect Sage to Jupyter. It says the kernel is dead, and the terminal tells me it times out trying to connect. I then tried starting sage in a different terminal before starting Jupyter Notebook as well, and it still couldn't connect. Thoughts? Why would it connect right after compile/install, but after a restart not connect?

Thierry

unread,
Apr 14, 2018, 4:14:20 PM4/14/18
to sage-...@googlegroups.com
The unstable release of Debian has Sage version 8.1 :
https://packages.debian.org/sid/sagemath

It seems there is no backport of recent version of Sage in Debian stable
yet, but it might appear in the future.

Ciao,
Thierry

Jordan Argyle

unread,
Apr 15, 2018, 11:11:58 PM4/15/18
to sage-devel
I'm so sorry I re-posted this error. It was the same original compile problem. Instead of using the normal compilers, it was pointing to the MOOSE compilers. So, commenting out the links to those compilers in .bashrc let the kernel connect just fine. The basic jist is, if you have different or custom compilers installed on your system, switch them back to the standard ones or the ones you compiled Sage with, and the kernels and everything should work fine!

If I start testing the debian packages and such, I'll let you know how those go.

Erik Bray

unread,
Apr 16, 2018, 3:52:38 AM4/16/18
to sage-devel
I knew it was in stretch--that was the last successful Debian effort I
knew about. Last I had heard it had mysteriously dropped out from
sid, but now apparently it's there:
https://packages.debian.org/unstable/math/sagemath \o/

Samuel Lelievre

unread,
Apr 16, 2018, 4:18:54 AM4/16/18
to sage-devel
Mon 2018-04-16 07:52:38 UTC, Erik Bray:
Reply all
Reply to author
Forward
0 new messages