Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserWarning: install_ext is deprecated #2

Open
PeterLuschny opened this issue Jul 13, 2016 · 5 comments
Open

UserWarning: install_ext is deprecated #2

PeterLuschny opened this issue Jul 13, 2016 · 5 comments

Comments

@PeterLuschny
Copy link

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)

in ()
----> 1 get_ipython().run_cell_magic(u'asy', u'', u'size(250);\n\nreal a=3;\nreal b=4;\nreal c=hypot(a,b);\n\ntransform ta=shift(c,c)_rotate(-aCos(a/c))_scale(a/c)_shift(-c);\ntransform tb=shift(0,c)_rotate(aCos(b/c))_scale(b/c);\n\npicture Pythagorean(int n) {\n picture pic;\n fill(pic,scale(c)_unitsquare,1/(n+1)_green+n/(n+1)_brown);\n if(n == 0) return pic;\n picture
branch=Pythagorean(--n);\n add(pic,ta_branch);\n add(pic,tb_branch);\n return pic;\n}\n\nadd(Pythagorean(12));')

/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

@empet
Copy link

empet commented Jul 13, 2016

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

@rebcabin
Copy link

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.

@empet
Copy link

empet commented Jan 31, 2017

@rebcabin To insert a screenshot you need only two lines of code:

from IPython.display import Image
Image(filename='my_screenshot.jpg')

@rebcabin
Copy link

rebcabin commented Feb 3, 2017

We got the magic %%asy to work:

  1.  Downlaod and install asymptote (separate application).
    
  2.  Setup system path so that typing ‘asy’ anywhere brought up the asymptote command line.
    
  3.  I put asymptote.py in the same dir as I ran jupyter notebook from.
    
  4.  I ran the magic %load_ext asymptote in the first cell of my notebook.
    
  5.  I cut and pasted in one of the examples.
    

@jaromrax
Copy link

jaromrax commented Jun 14, 2017

I tried - warnings - only the tree works, others crash, saying - No such file or directory: '/tmp/tmpsqnulrva/tmpe_ikv3a0.png'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants