Symbolic Package in MacOS


I am teaching a class using Octave and I have a few students using Macs. (I use Windows)

I found out that the Symbolic Package is not installed in Octave for Mac. I tried to help one of my students to install it by following some instrutions we found on the net (not on Octave Forge).

Used a "setenv" command but when tried to run "syms" we got an error related to SymPy problem involving directories location.

Can you please tell me if it is possible to install this package in Mac OS?

And if yes how can it be done?

Thank you for your help,


Hi, as far as I know, the package does install and work just fine on macOS systems.

Windows is the weird system that includes all packages by default, most operating systems will have the user installing the optional packages that they want to use one by one.

Can you be more specific about what exactly you have tried and what the exact errors were?

If the students have installed the latest version of SymPy on their system, they could be experiencing this known bug. Just a guess at this point.


hank you for your reply. My students have installed SymPy 1.8.
Also I had to go back and ask one of the students to send a copy error.
SymPy was apparently installed successfully but when running syms:

kf6lt0ro.bmp (1.2 MB)

As I said before, I suspect it is a problem with directories.


are you able to ask them what output they get from

sympref diagnose

as the error message suggests?

(it would help if messages were pasted here as text or browser compatible png/jpg/gif images and not bmp)

Then they are definitely hitting the bug report I guessed above. Please have them downgrade to SymPy 1.5.1, as mentioned in the bug report and here, and everything should work.


I was waiting for my class today to send you the result of sympref diagnose:
Symbolic package diagnostics

Python and SymPy are needed for most features of the Symbolic package.

The Python interpreter is currently: “python3”.

Computers may have more than one Python interpreter installed. If you
need to, you can select a different one using the PYTHON environment
variable (see “help sympref”). For example, to use Python 2, try
setenv PYTHON python2
sympref reset

Attempting to run python3 -c “print(“Python says hello”)”

status = 0
output = Python says hello

Good, Python ran correctly.

Python version

Let’s check what version of Python we are calling…

Attempting to run python3 -c “import sys; print(sys.version)”

status = 0
output = 3.9.1 (default, Jan 14 2021, 01:19:30)
[Clang 11.0.0 (clang-1100.0.33.17)]

SymPy Python Library

SymPy is a Python library used by Symbolic for almost all features.

Attempting to run python3 -c “import sympy; print(sympy.version)”

Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘sympy’
status = 1
output =

Unfortunately status was non-zero: probably Python cannot import sympy.

  • Is there an error message above?

  • Do you have SymPy installed? If not, please try to install it and
    try again.

  • If you do have SymPy installed, maybe it’s installed for a different
    Python interpreter than the one we found? Please try “setenv” as
    described above to change your python interpreter.

And this time in “text”!

this definitely sounds like what mike mentioned. there is currently a bug open with the symbolic package regarding sympy > v1.6.


the temporary solution seems to be:

for now I think you’ll need to downgrade sympy, something like pip install --user sympy==1.5.1

Actually, this sounds completely different. If you are sure that SymPy is installed, but it can’t be found at all when the symbolic package tries to use it, that looks like you may have two different Python installs and Octave is not using the same one that your other environment uses. For example, you may have a system Python, and a homebrew Python, and an Anaconda Python, and which one Octave uses depends on the PATH environment variable and the PYTHON environment variable.


That is what I thought.
And more I am almost certain.
Thanks to your help one out 3 students has as solved the problem.
One of the students installed python and the older version of sympy 1.5.1 and now symbolic is work.
Another repeated the process on his mac but still symbolic is not working.
He started to installl anaconda3, then uninstalled it and installed the same phyton and sympy as his colleague.
I believe that the sympy installation folder and the phyton Path are not the same.
However I have no idea where the sympy was installed (or how to look for it) on the Mac.
Also no idea on set the Path variable on Phyton.
Can you help me?

Thank you,


I can give you general tips to give to your student. But I am a Linux user, I don’t have a deep insight into the best way to install or configure these things on macOS. As a Linux user, helping you, a Windows user, to help your macOS student, is a bit like the telephone game, isn’t it? :grimacing:

Let’s say the student has a working Python and SymPy.

  1. First have them run a Python session with SymPy, and check what the Python executable is with

    import sys
  2. Next check the same thing in their Octave session. Have them run at the Octave command prompt

    system('python3 -c "import sys; print(sys.executable)"');
  3. If they are the same, then I see no reason why SymPy shouldn’t work in both instances. If SymPy doesn’t work in either, then they haven’t installed it right, and I can’t help much with that.

  4. If they are different Python executables, then the student should either adjust their PATH login environment variable so that it adds the directory that contains the right Python first. Or they can simply set the PYTHON environment variable in Octave to point to the right executable, for example

    setenv('PYTHON', '/path/to/some/bin/python3');
1 Like

mtmiller you really saved me lot of time, i was trying to resolve this issue in several ways since last night and spent so many hours… the problem is the different Python executables!

This is good information!

However, as the port maintainer of octave-symbolic of MacPorts, I’ve got the problem that I can’t install multiple versions of py-sympy for a given branch of Python. Other packages expect the current version of sympy, i.e. 1.9.0 at this time.

I can certainly create a py-sympy15 port and install it into a non-default Python branch (they conflict, as sympy 1.5.0 and 1.9.0 install into the same directory, but MacPorts permits multiple simultaneous Python branches to be installed), but this wouldn’t work well for end users.

IIUC, compatibility fixes for newer sympy versions were pushed to the octsympy repository. But no new release has been made in the meantime.
I never tested that. But maybe you could cherry-pick the changes from PR #1028 and #1051 (and possibly others?):
fix: compatible with sympy 1.6(#1023) by billchenchina · Pull Request #1028 · cbm755/octsympy (
fix of #1023 with changes from #1028 by jmfrank63 · Pull Request #1051 · cbm755/octsympy (

Or alternatively, you could try packaging the current development version…

In the meantime, I posted a PR for a sympy15 variant to py-sympy: py-sympy: add sympy15 variant for octave-symbolic by Schamschula · Pull Request #13813 · macports/macports-ports · GitHub. I’m waiting for that to be merged to push the updated octave-symbolic Portfile.

However, I’ll see if I can make the patches from PR #1028 and #1051 work.

Given a basic test, the patches from fix of #1023 with changes from #1028 by jmfrank63 · Pull Request #1051 · cbm755/octsympy · GitHub seem to work!

I pushed a new revision to the MacPorts octave-symbolic port.

Hopefully, that will work.