Octave, Symbolic, Sympy issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Octave, Symbolic, Sympy issue

Gabriel Schneck
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.
>>


Reply | Threaded
Open this post in threaded view
|

Re: Octave, Symbolic, Sympy issue

Colin Macdonald-2
On 2019-11-19 6:01 p.m., Gabriel Schneck wrote:
> 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.

Hmmmm, that certainly looks like you do not have SymPy installed.

At your terminal, can you try:

$ python
 >>> import sympy
 >>> exit()

$ python2
 >>> import sympy
 >>> exit()

thanks,
Colin


Reply | Threaded
Open this post in threaded view
|

Re: Octave, Symbolic, Sympy issue

Mike Miller-4
On Tue, Nov 19, 2019 at 20:38:14 -0800, Colin Macdonald wrote:

> On 2019-11-19 6:01 p.m., Gabriel Schneck wrote:
> > 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.
>
> Hmmmm, that certainly looks like you do not have SymPy installed.
>
> At your terminal, can you try:
>
> $ python
> >>> import sympy
> >>> exit()
>
> $ python2
> >>> import sympy
> >>> exit()
Also, are you able to verify that the 'python2' or 'python3' that you
get when you run it from a terminal is the same as the one that Octave
tries to run?

Can you try something like 'which python3' in a terminal, and compare it
with 'system "which python3"' in Octave?

As I understand it, you might easily have versions of Python installed
with Homebrew and with pyenv, for example, and the one that Octave finds
is not the same as the one you use in a terminal.

--
mike



signature.asc (849 bytes) Download Attachment