Ask Your Question

How to put Sage in Env Path in Windows

asked 2018-04-16 02:15:08 +0200

o6p gravatar image

updated 2018-04-17 10:33:03 +0200

slelievre gravatar image

I have installed Sage in windows 10 but for some reasons it's not in path. Running sage in cmd outputs: 'sage' is not recognized as an internal or external command, operable program or batch file..
I can't find sage.exe either to manually put it in path. What can I do? The reason I need to have the path to sage.exe is because I want to use sagetex and it needs sage to be in path. Currently, I' only able to produce .sout from sage by running sage manually and loading in the file manually. The sage that I'm loading has this full path:
"C:\Program Files\SageMath 8.1\runtime\bin\mintty.exe" -t 'SageMath 8.1 Console' -i sagemath.ico /bin/bash --login -c '/opt/sagemath-8.1/sage'
So I am not able to find sage.exe anywhere to automate this process possibly with latexmkrc.

edit retag flag offensive close merge delete


Can I get a help with this one? I really need to do this somehow

o6p gravatar imageo6p ( 2018-04-17 01:52:04 +0200 )edit

I want to be able to call sage from command line on the sagetex generated file. Can anybody help?

o6p gravatar imageo6p ( 2018-04-17 05:37:06 +0200 )edit

Hi - not sure if you fi figured out a good solution right now but I run in the same problem. IMHO it looks as if there doesn't exist any sage.exe or alike but only a huge bunch of skripts that do run whatever (pathon?) procedures and produce sagemath output.

I found a solution somewhere else (stackexchange) but as the guy who posted wrote it doesn't seem the most effective one:

"... I managed to get it to work good enough for my purposes- I used the following in a .bat file to run sage on a .sagetex.sage file: cmd /c C:\Progra~1\SageMath-8.1\runtime\bin\mintty.exe -t SageTeX /bin/bash --login -c "cd %cygpath% && /opt/sagemath-8.1/sage %2.sagetex.sage | tee %2.sagetex.log" | more


Hope to find a easier way somewhere. - Take care all.

vcf gravatar imagevcf ( 2018-08-02 16:31:13 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-17 08:47:21 +0200

slelievre gravatar image

updated 2018-04-17 10:39:02 +0200

SageTeX with Sage-Windows

Have you tried from the Sage shell instead of the Windows command-line?

In a Sage shell, you should be able to cd to the appropriate location and run

$ sage yourfile.sagetex.sage

and possibly also (I don't know if Sage-Windows ships LaTeX...):

$ latex yourfile.tex

SageTeX in the Windows Subsystem for Linux

Another option for you is to install the Windows Subsystem for Linux (in Windows 10's advanced user preferences), and then you can have Ubuntu running inside of Windows, and you can

$ sudo apt install sagemath-jupyter
$ sudo apt install latex-full

and you can use all the power of Linux inside Windows.

edit flag offensive delete link more


Sage shell makes it impossible to automate this through latexmkrc or with anything at all. I said it in the post that the only solution I've got is by running sage in shell and load(tex.sage). As noted, this is slow and not the best solution. Why am I not able to find the binary for sage? I thought with Sage8.1 Windows 10 was fully supported.

o6p gravatar imageo6p ( 2018-04-17 09:22:29 +0200 )edit
  • Reading package lists... Done
  • Building dependency tree Reading
  • state information... Done E: Unable
  • to locate package sagemath-jupyter

  • Reading package lists... Done

  • Building dependency tree Reading
  • state information... Done E: Unable
  • to locate package latex-full

I stated I could do this using the first method in my post so I'm after the second method only. I'm getting these messages in my WSYL bash terminal. Also, trying to type sage in WSYL doesnt work either: No command 'sage' found, did you mean: Command 'save' from package 'atfs' (universe) Command 'page' from package 'tcllib' (universe) Command 'osage' from package 'graphviz' (main) sage: command not found

o6p gravatar imageo6p ( 2018-04-17 14:08:17 +0200 )edit

I think current documentation is horrible. I'm trying to install linux binaries with WSYL bash now, but after extracting .tar and cd'ing there and running make i'm getting this error: /mnt/c/MinGW/bin/aclocal: /mnt/c/MinGW/bin/aclocal-1.11: /bin/perl: bad interpreter: No such file or directory

Why is this so hard seriously and why are there no guides at all?

o6p gravatar imageo6p ( 2018-04-17 17:14:56 +0200 )edit

One way to improve the documentation is to point to specific things that could be improved.

slelievre gravatar imageslelievre ( 2018-04-17 17:23:06 +0200 )edit

Do I understand correctly that you installed the Windows subsystem for Linux, and then Ubuntu in it?

Which version of Ubuntu does that get you? Ubuntu 16.04? Ubuntu 17.10?

I would recommend running the following in a shell session.

sudo apt install binutils gcc g++ gfortran make m4 perl tar git \
  openssl libssl-dev texlive texlive-latex-extras dvipng ffmpeg \
  imagemagick tk tk-dev libcurl-dev perl-tk

Then install SageMath in one of the following two ways:

Not sure building from source works in the Windows Subsystem for Linux.

slelievre gravatar imageslelievre ( 2018-04-17 17:30:28 +0200 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2018-04-16 02:15:08 +0200

Seen: 3,859 times

Last updated: Apr 17 '18