Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

Hi! I ask you for help to deal with a problem with the linsolve command.

The expression I write is simplified: the presence of the input_form() is linked to the fact that linsolve is iterated within a for loop and therefore I have to adapt the arguments of the command linsolve to the presence of the cyclic variable, which for this example I have removed.

The following command works in the cadabra cloud version

import cdb.sympy.solvers as solv

I := 0 = a + b + 13;
II := 0 = b + 2*a - 34;
sols=solv.linsolve(Ex(str(I.input_form())+r','+str(II.input_form())),Ex(r'a'+r',b'));
sols[0][0];
sols[0][1];

but never works using the github one, giving the error:

AttributeError: module 'sympy' has no attribute 'linsolve'

At:
/home/ubuntu-mate/.config/cadabra_packages/cdb/sympy/solvers.py(35): linsolve
/home/ubuntu-mate/.config/cadabra_packages/cdb/sympy/solvers.py(49):

(222): _call_with_frames_removed (665): exec_module (673): _load_unlocked (958): _find_and_load_unlocked (969): _find_and_load (2):

Thanks, Mattia

in General questions by (410 points)

1 Answer

+1 vote

Your sympy does not have linsolve, better upgrade it to something more recent.

by (82.6k points)

Dear Kasper, thanks for your reply. The commend sympy.__version__ gives 0.7 in my github Cadabra version. I updated my sympy version with the shell command $ pip install --upgrade sympy and the command pip show sympy gives now 1.5 (the sympy version on the cloud is 1.4). Unfortunately, when then I run sympy.__version__ again, i continue to have the o.7 version... how can I solve? Thanks, Mattia

Welcome to the world of broken python package management, which everyone seems to think is great but actually could not possibly be any worse.

You probably have some system package with sympy installed as well; given your error message, it looks like you might get this solved with sudo apt uninstall python3-sympy.

...