Sympy, Symbolic and OCTAVE

98 views
Skip to first unread message

Gabriel Schneck

unread,
Nov 19, 2019, 3:43:25 PM11/19/19
to sympy
Hello all,

To save my life I can not get the symbolic package to work in Octave because it is dependent on Sympy.  When I run terminal on my Mac it shows that I have python and sympy. However, when I try to run a "sym x" I get "Python cannot import SymPy: have you installed SymPy?"  I'm confused.  I included some information below.

Thanks for the help.

Gabriel

>> pkg load symbolic
>> sym x
Symbolic pkg v2.8.0: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'
error: Python cannot import SymPy: have you installed SymPy?
    Try "sympref diagnose" for more information.
error: called from
    assert_have_python_and_sympy at line 123 column 7
    python_ipc_popen2 at line 79 column 5
    python_ipc_driver at line 59 column 13
    python_cmd at line 163 column 9
    sym at line 452 column 9
>>

>> 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 3, try
    setenv PYTHON python3
    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.7.1 (default, Feb  5 2019, 15:14:49)
[Clang 8.0.0 (clang-800.0.42.1)]


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 "<string>", line 1, in <module>
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.
>> setenv PYTHON python2
>> sym x
Symbolic pkg v2.8.0: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sympy
error: Python cannot import SymPy: have you installed SymPy?
    Try "sympref diagnose" for more information.
error: called from
    assert_have_python_and_sympy at line 123 column 7
    python_ipc_popen2 at line 79 column 5
    python_ipc_driver at line 59 column 13
    python_cmd at line 163 column 9
    sym at line 452 column 9
>> setenv PYTHON python2
>> setenv PYTHON python3
>> sym x
Symbolic pkg v2.8.0: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'
error: Python cannot import SymPy: have you installed SymPy?
    Try "sympref diagnose" for more information.
error: called from
    assert_have_python_and_sympy at line 123 column 7
    python_ipc_popen2 at line 79 column 5
    python_ipc_driver at line 59 column 13
    python_cmd at line 163 column 9
    sym at line 452 column 9
>> pkg load symbolic
>> sym x
Symbolic pkg v2.8.0: Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'
error: Python cannot import SymPy: have you installed SymPy?
    Try "sympref diagnose" for more information.
error: called from
    assert_have_python_and_sympy at line 123 column 7
    python_ipc_popen2 at line 79 column 5
    python_ipc_driver at line 59 column 13
    python_cmd at line 163 column 9
    sym at line 452 column 9
>> 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 3, try
    setenv PYTHON python3
    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.7.1 (default, Feb  5 2019, 15:14:49)
[Clang 8.0.0 (clang-800.0.42.1)]


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 "<string>", line 1, in <module>
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.
>>

Aaron Meurer

unread,
Nov 19, 2019, 6:51:13 PM11/19/19
to sympy
I'm not too familiar with octave symbolic, but it basically looks like
you don't have SymPy installed. As the diagnostics say, the Python
that opens when you run 'python' at the command line might not be the
same one used by Octave. You can tell which Python you are starting
from the command line with 'which python'. I don't know how to tell
which Python Octave is using. You'll want to figure that out, and run
'python -m pip install sympy' using that Python.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/ee0599b3-667c-4fcf-978e-faa42f012806%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages