Problem running symbolic package v2.9.0 on MaxOS with sympy v1.7.1

I’m a noob using Octave and struggled to install or use the “symbolic” package properly. Questions at the end of this message.
All instances of https:// replaced with h_____ to adhere to hyperlink restrictions for newbies posting; apologies :expressionless:

I'm using:

  • MacOS Big Sur v11.2.1
  • GNU Octave, v6.1.0 installed using HomeBrew
    .> Symbolic pkg v2.9.0
  • Python v3.9.1
    .> mpmath v1.2.1 installed using pip3
    .> sympy v1.7.1 installed using pip3

Dependencies for Symbolic pkg v2.9.0 @ Octave Forge - The 'symbolic' package are:

  • octave ≥ 4.2. OK!
    Runtime system dependencies
  • python, sympy (≥ 1.2) OK!
  • mpmath (≥ 1.0) OK!

SymPy supports according to Installation — SymPy 1.7.1 documentation
Only Python 3.5, 3.6, 3.7, and PyPy. (not OK?)
SymPy seems to be working in Python v3.9.1 as shown below.

I tested the sympy package at the Python prompt by doing the following

$ python
.>>> from sympy import *
.> x = Symbol('x')
.>>> limit(sin(x)/x, x, 0)
.>>> integrate(1/x, x)

When I do the following in Octave

>> pkg load symbolic
>> syms a b c x
Symbolic pkg v2.9.0: Traceback (most recent call last):
  File "<stdin>", line 28, in <module>
AttributeError: '_PrintFunction' object has no attribute '__globals__'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 12, in octoutput_drv
  File "<stdin>", line 54, in octoutput
  File "<stdin>", line 55, in octoutput
AttributeError: module 'sympy' has no attribute 'compatibility'
Closing the Python communications link.

error: Python exception: AttributeError: '_PrintFunction' object has no attribute '__globals__'
    occurred in python_header import block.
    Try "sympref reset" and repeat your command?
    (consider filing an issue at
error: called from
    pycall_sympy__ at line 191 column 5
    valid_sym_assumptions at line 38 column 10
    assumptions at line 82 column 7
    syms at line 97 column 13

I tried sympref reset and repeated syms a b c x as suggested in the message above.
I did not log the problem at Issues · cbm755/octsympy · GitHub as was not sure what to report exactly.

I used the messages below reporting similar problems to base my questions on.


  1. Am I doing something wrong; overlooking something or missing something?
  2. Should I try downgrading my version of SymPy to 1.6 or even 1.5.1?
  3. Do these versions of SymPy work with Python 3.9 or should I downgrade my version of Python to ver 3.7 as well?
  4. How should I do these changes in order to make it all work correctly in Octave? It was already an adventure to get this far ;-).

All help is greatly appreciated.
Thanks in advance

AFAICT, you’ll need sympy 1.5.1 as of now:
symbolic not working with sympy 1.6 · Issue #1023 · cbm755/octsympy (

Will that work with Python 3.9?

Let me google that for you:
sympy 1.5.1 - Google Suche

Looks like it should.

My apologies for these inconveniences. Usually a first time user posting many many links is suspected to be a spam bot :sweat_smile: I increased the tolerance level from 2 to 10 links for a first time poster and reformatted your post that it is easier to read for users giving you help.

Thank you, much appreciated.!

Thanks very much for your help.

Just to reiterate for others that have a similar question.

  • Symbolic package v2.9.0 still require Sympy version v1.5.1.
  • Higher Sympy versions do still not work yet.
  • Sympy version up to 1.7.1 will work on Python 3.9 even though the Sympy website states it only has been tested up to Python 3.7.

Thanks to everybody to make software like this available.
Much appreciate all your efforts.