Can't Run Macaulay2 via SageMath in Jupyter Notebook

asked 2021-05-14 04:08:57 +0200

mcummings gravatar image

I am attempting to access Macaulay2 via Sage in a Jupyter Notebook, but Sage can't find macaulay2. Any attempt to call macaulay2, such as,

macaulay2('3/5 + 7/11')

raises a chain of error messages; the first one reading, ExceptionPexpect: The command was not found or was not executable: M2. The other errors are similar, "Your attempt to start Macaulay2 failed, either because you do not have Macaulay2 installed, or because it is not configured correctly".

Addressing the suggested fixes from this output:

  • Macaulay2 is installed on my computer, and is in the default location (/usr/local/bin/M2);
  • It starts from the terminal (both terminal.app and the jupyter terminal) with M2;
  • When I run sage in either terminal, it can run Macaulay2.

I also downloaded the most recent release of Sage, but the problem persists. Are there any suggestions as to the cause of this issue or a fix?

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2021-05-14 20:04:56 +0200 )edit

I cannot reproduce this. It should work if M2 is on the PATH, i.e. not an alias. Could you try the following?

m2 = Macaulay2(command='/usr/local/bin/M2')
m2('3/5 + 7/11')

How did you install Sage? With a package manager?

mwageringel gravatar imagemwageringel ( 2021-05-15 17:19:42 +0200 )edit

In the Jupyter terminal, the CLI version of Sage (compiled from source) does not launch for me, but that is a different issue.

mwageringel gravatar imagemwageringel ( 2021-05-15 17:24:09 +0200 )edit

See some hints at Sage Trac ticket 31773 about setting the PATH for SageMath sessions via the SageMath kernel in Jupyter.

slelievre gravatar imageslelievre ( 2021-05-15 18:21:06 +0200 )edit