Code Monkey home page Code Monkey logo

Comments (8)

blink1073 avatar blink1073 commented on July 2, 2024 1

Hmm, perhaps this command will give us a better answer. python -m octave_kernel.check. oct2py uses the octave_kernel to interact with Octave.

from oct2py.

blink1073 avatar blink1073 commented on July 2, 2024

Hi @HamidKarimi-Rouzbahani, what is the error that is printed? It his coming from this line.

from oct2py.

HamidKarimi-Rouzbahani avatar HamidKarimi-Rouzbahani commented on July 2, 2024

Hi @blink1073,

Thanks for getting back to me.

The error is as above:

ImportError: cannot import name 'octave' from 'oct2py' (C:\Users\99021\Anaconda3\envs\pyspi\lib\site-packages\oct2py\ init.py)

Please note that it drops the double underlines before and after init when I paste the error here.

I am not sure which line of init it comes from. Sorry, I am not super familiar with Python.

Is there any more information that can help you?

I am trying to use the pyspi toolbox, which seems to use some matlab codes and therefore needs octave. So, it calls oct2py to load octave but seems to fail. I have installed GNU octave from here: https://octave.org/download

Thanks

from oct2py.

HamidKarimi-Rouzbahani avatar HamidKarimi-Rouzbahani commented on July 2, 2024

Command Prompt returns this error:

C:\Program Files\Python\Python39\python.exe: Error while finding module specification for 'octave_kernel.check.' (ModuleNotFoundError: No module named 'octave_kernel')

Would it be possible to drop a few lines here about how to install octave and load it through oct2py in Spyder? Maybe if I understand how it is to be done, I can manage to fix the problem somehow.

from oct2py.

blink1073 avatar blink1073 commented on July 2, 2024

This looks like a multiple-pythons issue. I'd recommend asking for help from the spyder folks, I haven't used spyder in many years.

from oct2py.

zhrli avatar zhrli commented on July 2, 2024

Hmm, perhaps this command will give us a better answer. python -m octave_kernel.check. oct2py uses the octave_kernel to interact with Octave.

I have the same problem when I import octave

root@62ec78395647:/home# python3 -m octave_kernel.check
Octave kernel v0.35.1
Metakernel v0.30.1
Python v3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Python path: /usr/bin/python3

Connecting to Octave...
Octave connection established
Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f7bab7b8610>
command: /usr/bin/octave
args: [b'/usr/bin/octave', b'--interactive', b'--quiet', b'--no-init-file']
buffer (last 100 chars): ''
before (last 100 chars): ''
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 306
child_fd: 6
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile('octave.*>')

from oct2py.

zhrli avatar zhrli commented on July 2, 2024

Hmm, perhaps this command will give us a better answer. python -m octave_kernel.check. oct2py uses the octave_kernel to interact with Octave.

And I ran this :

import oct2py
dir(oct2py)
['Cell', 'Oct2Py', 'Oct2PyError', 'Struct', 'StructArray', 'all', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', 'demo', 'get_log', 'kill_octave', 'speed_check', 'thread_check']
dir(oct2py.Oct2Py)
['class', 'del', 'delattr', 'dict', 'dir', 'doc', 'enter', 'eq', 'exit', 'format', 'ge', 'getattr', 'getattribute', 'gt', 'hash', 'init', 'init_subclass', 'le', 'lt', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_exist', '_feval', '_get_doc', '_get_function_ptr', '_get_max_nout', '_get_user_class', '_handle_stdin', '_isobject', '_parse_error', '_print_doc', 'eval', 'exit', 'extract_figures', 'feval', 'get_pointer', 'logger', 'pull', 'push', 'restart']
oc = Oct2Py()
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/oct2py/core.py", line 563, in restart
self._engine = OctaveEngine(stdin_handler=self._handle_stdin, logger=self.logger)
File "/usr/local/lib/python3.10/dist-packages/octave_kernel/kernel.py", line 185, in init
self.repl = self._create_repl()
File "/usr/local/lib/python3.10/dist-packages/octave_kernel/kernel.py", line 416, in _create_repl
repl = REPLWrapper(cmd, orig_prompt, change_prompt,
File "/usr/local/lib/python3.10/dist-packages/metakernel/replwrap.py", line 88, in init
self.set_prompt(prompt_regex,
File "/usr/local/lib/python3.10/dist-packages/metakernel/replwrap.py", line 112, in set_prompt
self.child.expect(prompt_regex)
File "/usr/local/lib/python3.10/dist-packages/pexpect/spawnbase.py", line 343, in expect
return self.expect_list(compiled_pattern_list,
File "/usr/local/lib/python3.10/dist-packages/pexpect/spawnbase.py", line 372, in expect_list
return exp.expect_loop(timeout)
File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 181, in expect_loop
return self.timeout(e)
File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 144, in timeout
raise exc
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f42fc42dba0>
command: /usr/bin/octave
args: [b'/usr/bin/octave', b'--interactive', b'--quiet', b'--no-init-file']
buffer (last 100 chars): ''
before (last 100 chars): ''
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 398
child_fd: 9
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile('octave.*>')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.10/dist-packages/oct2py/core.py", line 87, in init
self.restart()
File "/usr/local/lib/python3.10/dist-packages/oct2py/core.py", line 565, in restart
raise Oct2PyError(str(e))
oct2py.utils.Oct2PyError: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f42fc42dba0>
command: /usr/bin/octave
args: [b'/usr/bin/octave', b'--interactive', b'--quiet', b'--no-init-file']
buffer (last 100 chars): ''
before (last 100 chars): ''
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 398
child_fd: 9
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile('octave.*>')

from oct2py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.