Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Octave 4.2.2 and sympy 1.6

Tags:

octave

sympy

Iam trying to use Octave 4.2.2 with Symbolic pkg v.2.9.0 but I get this error related to sympy package:

Your kit looks good for running the Symbolic package.  Happy hacking!

>>
>> syms
Symbolic variables in current scope:
>> a = sym( "a" );
Symbolic pkg v2.9.0: /home/usuario/.local/lib/python3.6/site-packages/sympy/__init__.py:676: SymPyDeprecationWarning:

importing sympy.core.compatibility with 'from sympy import *' has been
deprecated since SymPy 1.6. Use import sympy.core.compatibility
instead. See https://github.com/sympy/sympy/issues/18245 for more
info.

  deprecated_since_version="1.6").warn()
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
  File "/home/usuario/.local/lib/python3.6/site-packages/sympy/__init__.py", line 677, in __getattr__
    return getattr(self.mod, name)
AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
Waiting................warning: readblock: timeout of 30 exceeded, breaking out
warning: called from
    readblock at line 101 column 7
    python_ipc_popen2 at line 99 column 14
    python_ipc_driver at line 62 column 13
    pycall_sympy__ at line 163 column 9
    sym at line 452 column 9
no output so far

error: ipc_popen2: something wrong? timed out starting python
error: called from
    python_ipc_popen2 at line 101 column 7
    python_ipc_driver at line 62 column 13
    pycall_sympy__ at line 163 column 9
    sym at line 452 column 9
>> a
error: 'a' undefined near line 1 column 1
>>

I dig into code and find this two references:

https://github.com/sympy/sympy/pull/18245 https://github.com/sympy/sympy/pull/19316

But Iam not a programmer so any idea is greatly appreciated.

I tried to uninstall sympy-1.6 and install sympy-1.5 but that doesn't work.

Thanks for your time.

Daniel

like image 656
Daniel Alejandro Gil Avatar asked Jun 13 '20 00:06

Daniel Alejandro Gil


People also ask

How do I install SymPy on Octave?

At the Octave prompt, type syms x, then f = (sin (x/2))^3, diff (f, x), etc. The symbolic-win-py-bundle package should have no dependencies other than Octave (it includes SymPy and a Python interpreter). Alternatively, you can install Python and SymPy yourself and use the standard pkg install -forge symbolic command.

Is there a symbolic package in Octave Forge?

There was a previous "symbolic" package in Octave Forge based on GiNaC. Its history has now been merged into this project. "SymPy CAS" by Jonathan Lister .

How to load symbolic symbols in octave?

At the Octave prompt, type pkg load symbolic. At the Octave prompt, type syms x, then f = (sin (x/2))^3 , diff (f, x), etc. If you encounter any difficulties (even minor ones) please read and if possible help us improve the wiki page on Windows Installation. Although this package is designed for GNU Octave, it will work with Matlab.

What's new in GNU Octave?

Adds symbolic calculation features to GNU Octave. These include common Computer Algebra System tools such as algebraic operations, calculus, equation solving, Fourier and Laplace transforms, variable precision arithmetic and other features. Compatibility with other symbolic toolboxes is intended.


2 Answers

I have managed to found the answer. The problem is on sympy version 1.6 so I downgraded it to version 1.5.1 with pip3.

like image 157
Daniel Alejandro Gil Avatar answered Sep 16 '22 21:09

Daniel Alejandro Gil


I had a similar issue, the problem seems to be that you have to install sympy for python2 not for python3. Install it with pip and then try typing in octave

sympref diagnose And it will tell you that the current interpreter is python3, you got to change this. setenv PYTHON python2 sympref reset Because apparently the symbolic package was developed for python2. I hope I could help you.

like image 34
Diego Dominguez Avatar answered Sep 20 '22 21:09

Diego Dominguez