Can't Run Macaulay2 via SageMath in Jupyter Notebook
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?
Welcome to Ask Sage! Thank you for your question!
I cannot reproduce this. It should work if
M2
is on the PATH, i.e. not an alias. Could you try the following?How did you install Sage? With a package manager?
In the Jupyter terminal, the CLI version of Sage (compiled from source) does not launch for me, but that is a different issue.
See some hints at Sage Trac ticket 31773 about setting the PATH for SageMath sessions via the SageMath kernel in Jupyter.