LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-26-2021, 09:03 PM   #1
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Rep: Reputation: 51
Question octave needed symbolic, symbolic needed sympy, sympy gives error


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 lines
So, 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?

Last edited by dedec0; 07-26-2021 at 09:05 PM.
 
Old 07-27-2021, 04:19 AM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,686

Rep: Reputation: Disabled
The Python interpreter used by Octave is python3, but the pip command you're using is for python2. Try
Code:
pip3 install sympy
That said, the package octave-symbolic is provided by Debian Stretch repos. And installing it would take care of instaling python-sympy as well.

Last edited by shruggy; 07-27-2021 at 04:26 AM.
 
1 members found this post helpful.
Old 07-27-2021, 05:30 AM   #3
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Question

Quote:
Originally Posted by shruggy View Post
The Python interpreter used by Octave is python3, but the pip command you're using is for python2. Try
Code:
pip3 install sympy
That said, the package octave-symbolic is provided by Debian Stretch repos. And installing it would take care of instaling python-sympy as well.
So, in my machine, i ran that pip3 command with root. But *after* it being successfully ended, synaptic still wants to install packages python-sympy and python-mpmath:

https://images2.imgbox.com/0a/25/OCnVYmwf_o.png

Is this just because i did not install sympy for python 2? Id est, i did not do the command:

Code:
pip install sympy
 
Old 07-27-2021, 05:36 AM   #4
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,686

Rep: Reputation: Disabled
Quote:
Originally Posted by dedec0 View Post
So, in my machine, i ran that pip3 command with root
Why as root?

I wouldn't mess around with pip at all unless absolutely necessary. It is not necessary in this case:
Code:
apt-get install octave-symbolic

Last edited by shruggy; 07-27-2021 at 05:39 AM.
 
Old 07-27-2021, 05:52 AM   #5
dedec0
Senior Member
 
Registered: May 2007
Posts: 1,372

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by shruggy View Post
Why as root?
Because i want to install it for everyone that uses this computer. And if i ran it without root priviledges, it would be installed in my home folder.

Quote:
Originally Posted by shruggy View Post
I wouldn't mess around with pip at all unless absolutely necessary. It is not necessary in this case:
Code:
apt-get install octave-symbolic
You did not say it would not be necessary. I thought i needed to do (as root or not) the pip3 command and, after it, install the octave-symbolic package.

These things are confusing... several ways to do... good and bad reasons for choices... things that do not exist, are hard to find, or do not work...

Well, I will let synaptic do what it wants, then.

Last edited by dedec0; 07-27-2021 at 05:55 AM.
 
  


Reply

Tags
debian lts, debian stable, gnu octave, python, sympy



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't compile octave on slackware current libinterp/dldfcn/__delaunayn__.la] Error 2 slacknedo Slackware 19 04-30-2019 08:45 AM
[SOLVED] windows python: how to install sympy zak100 Programming 14 06-15-2018 02:40 AM
[SOLVED] Octave 3.4.2 gives compilation error on Slackware-current 64 Bindestreck Slackware 1 05-25-2012 11:26 AM
GNU Octave compile error and fix without recompile ivanp84 Slackware 2 02-12-2012 04:54 AM
[help] Octave 3.2: execution error. missing library /cricket Slackware 4 07-30-2009 05:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration