ipython-asymptote
ipython-asymptote copied to clipboard
UserWarning: install_ext is deprecated
Unfortunately I cannot use this extension. I am not sure if this is related to the deprecation warning or an issue of the SageMath installation.
Install the IPython magic extension %install_ext http://raw.github.com/azjps/ipython-asymptote/master/asymagic.py
/home/sage/sage-7.2/local/lib/python2.7/site-packages/IPython/core/magics/extension.py:47: UserWarning: %install_ext` is deprecated, please distribute your extension as a python package. "as a python package.", UserWarning)
Executing the examples gives:
OSError Traceback (most recent call last)
/home/sage/sage-7.2/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_cell_magic(self, magic_name, line, cell) 2118 magic_arg_s = self.var_expand(line, stack_depth) 2119 with self.builtin_trap: -> 2120 result = fn(magic_arg_s, cell) 2121 return result 2122
After migration from IPython 3.x to Jupyter a lot of changes were performed. Here you can find how to install and enable an extension in the Jupyter notebook:
http://jupyter-notebook.readthedocs.io/en/latest/extending/frontend_extensions.html#installing-and-enabling-extensions
After reading the link above, here is something that doesn't work:
$ jupyter nbextension install http://raw.github.com/azjps/ipython-asymptote/master/asymagic.py
that deposits asymagic.py
in your /usr/local/share/jupyter/nbextensions
directory, where it is a dead letter. There are a bunch of javascript wrappers and other stuff needed to get it going. I peeked into the rabbit-hole and decided to stay out. I will try to find a way to paste screenshots into my jupyter notebooks.
@rebcabin To insert a screenshot you need only two lines of code:
from IPython.display import Image
Image(filename='my_screenshot.jpg')
We got the magic %%asy to work:
-
Downlaod and install asymptote (separate application).
-
Setup system path so that typing ‘asy’ anywhere brought up the asymptote command line.
-
I put asymptote.py in the same dir as I ran jupyter notebook from.
-
I ran the magic %load_ext asymptote in the first cell of my notebook.
-
I cut and pasted in one of the examples.
I tried - warnings - only the tree works, others crash, saying - No such file or directory: '/tmp/tmpsqnulrva/tmpe_ikv3a0.png'