Symbolic Package in MacOS

Hello,

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,

Carmo

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.

Hello,

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.

Carmo

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.

Hello,

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.

see:

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.

Hello,

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,

Carmo

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
    print(sys.executable)
    
  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!