Article 5MM5Y octave needed symbolic, symbolic needed sympy, sympy gives error

octave needed symbolic, symbolic needed sympy, sympy gives error

by
dedec0
from LinuxQuestions.org on (#5MM5Y)
Hello,

today, i helped someone with a little GNU Octave issue. The error was simple, a missing parenthesis. But i cannot use the code that this friend uses in her GNU Octave.

A similar octave code that should work, but i cannot do it, is:

Code:pkg symbolic load
syms x
y = -(1/4*(13-sen(x)^2))
diff (y)First, i tried with the octave installed in my machine. But the situation is the following:

Code:>> pkg symbolic load
error: package symbolic is not installed
error: called from
load_packages at line 53 column 11
pkg at line 422 column 7

>> pkg install -forge symbolic
error: the following dependencies were unsatisfied:
symbolic needs octave >= 4.2.0

>>But for my distribution (Debian 9, Stretch), GNU Octave (with my repositories, at least) cannot be updated. Its version is 4.0.3. But keep reading, the problem description for this thread does not end here.

I have access to a remote machine where things seem to be updated more often. So, i tried to run the octave code there. See everything i copied from the terminal session in that machine:

Code:$ octave
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
GNU Octave, version 4.4.1
[...]
Octave was configured for "x86_64-pc-linux-gnu".
[...]

octave:1> pkg symbolic load
error: package symbolic is not installed
error: called from
load_packages at line 41 column 7
pkg at line 457 column 7

octave:1> pkg install -forge symbolic
warning: creating installation directory /home/[me]/octave
warning: called from
install at line 30 column 5
pkg at line 437 column 9
For information about changes from previous versions of the symbolic package, run 'news symbolic'.

octave:2> pkg symbolic load

octave:3> syms x
Symbolic pkg v2.9.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 62 column 13
pycall_sympy__ at line 163 column 9
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13

[...]

octave:3> pkg symbolic load

octave:3> pkg install -forge sympy
error: get_forge_pkg: package not found: "sympy". Maybe you meant "nurbs?"
error: called from
get_forge_pkg at line 84 column 5
get_forge_download at line 26 column 12
pkg at line 403 column 29

octave:3> pkg install -forge nurbs
error: the following dependencies were unsatisfied:
nurbs needs octave >= 5.1

>> # ctrl+d, but nurbs (being whatever it is) needs octave 5.1??! come on!

$ aptitude # without root account access, just to check things
$ # There are python3-sympy , python-sympy packages both v. 1.3-2 to install

$ # octave again because there is another detail mentioned with an error shown
$ octave
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
GNU Octave, version 4.4.1
[...]
Octave was configured for "x86_64-pc-linux-gnu".

octave:1> pkg load symbolic

octave:2> syms x
Symbolic pkg v2.9.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 62 column 13
pycall_sympy__ at line 163 column 9
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13

octave:2> 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 2, try
setenv PYTHON python2
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.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0]

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.

octave:3> # ctrl+d

$ # now, let's try sympy with pip
$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> from sympy import * # sympy exists for python?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sympy'

>>> # ctrl+d

$ # So pip is another command to be run in shell... ok
$ pip --version
pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)

$ pip install sympy
Collecting sympy
Downloading https://files.pythonhosted.org/packages/ce/5b/acc12e3c0d0be685601fc2b2d20ed18dc0bf461380e763afc9d0a548deb0/sympy-1.5.1-py2.py3-none-any.whl (5.6MB)
100% || 5.6MB 181kB/s
Collecting mpmath>=0.19 (from sympy)
Downloading https://files.pythonhosted.org/packages/95/ba/7384cb4db4ed474d4582944053549e02ec25da630810e4a23454bc9fa617/mpmath-1.2.1.tar.gz (2.1MB)
100% || 2.2MB 490kB/s
Complete output from command python setup.py egg_info:
/tmp/easy_install-BlBFCn/setuptools_scm-6.0.1/src
<pkg_resources.WorkingSet object at 0x7f04ef262c10>
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-J1ENf_/mpmath/setup.py", line 6, in <module>
setuptools.setup(use_scm_version=True)
File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 724, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
return installer(requirement)
File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 791, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
run_setup(setup_script, args)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/lib/python2.7/dist-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-BlBFCn/setuptools_scm-6.0.1/setup.py", line 52, in <module>

File "/tmp/easy_install-BlBFCn/setuptools_scm-6.0.1/setup.py", line 29, in scm_config

File "/tmp/easy_install-BlBFCn/setuptools_scm-6.0.1/src/setuptools_scm/__init__.py", line 8, in <module>
File "/tmp/easy_install-BlBFCn/setuptools_scm-6.0.1/src/setuptools_scm/config.py", line 6, in <module>
File "/tmp/easy_install-BlBFCn/setuptools_scm-6.0.1/src/setuptools_scm/utils.py", line 41
print(*k)
^
SyntaxError: invalid syntax

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-J1ENf_/mpmath/


$ # pip seemed to work, since it downloaded 2 things, but in the end it
$ # threw all these error linesSo, it did not work. Can you help me solve this?

Is it possible to install older pips or older octave packages, that are compatible with the versions of it that are still in use?latest?d=yIl2AUoC8zA latest?i=YlCHP7VjrPs:8BSH51497c4:F7zBnMy latest?i=YlCHP7VjrPs:8BSH51497c4:V_sGLiP latest?d=qj6IDK7rITs latest?i=YlCHP7VjrPs:8BSH51497c4:gIN9vFwYlCHP7VjrPs
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments