Issue
I am trying to draft a MATLAB/Octave tutorial on Google Colab, and was hoping to use magic commands %octave
and %%octave
to write most of the cells. However, when I tried to setup the environment using the below commands
!apt-get install octave
!pip install oct2py
%load_ext oct2py.ipython
I got an error AttributeError: module 'oct2py' has no attribute 'octave'
for the %load_ext
command above, here is the full error log:
AttributeError Traceback (most recent call last)
<ipython-input-3-0c05e6d2529c> in <cell line: 3>()
1 get_ipython().system('apt-get install octave')
2 get_ipython().system('pip install oct2py')
----> 3 get_ipython().run_line_magic('load_ext', 'oct2py.ipython')
7 frames
<decorator-gen-57> in load_ext(self, module_str)
/usr/local/lib/python3.9/dist-packages/oct2py/ipython/octavemagic.py in __init__(self, shell)
70 """
71 super().__init__(shell)
---> 72 self._oct = oct2py.octave
73
74 # Allow display to be overridden for
AttributeError: module 'oct2py' has no attribute 'octave'
I am wondering if this is a known issue, and if there is any workaround.
Solution
As @OriYarden noted in a previous reply - the commands in fact worked fine. The previous issue I had may just be a glitch due to incomplete installation.
Again, these 3 commands do work (takes 4-5 min to complete) to make Google Colab to support Octave magic commands
!apt-get install octave
!pip install oct2py
%load_ext oct2py.ipython
Answered By - FangQ
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.