-
Notifications
You must be signed in to change notification settings - Fork 293
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
Magic function %prun not printing #3119
Comments
I encountered the same problem. The issue seems to be that jupyter does not output the result of |
Thanks @ARF1, if Jupyter doesn't output a cell that would be why prun doesn't have any output. We currently only show cell based output. |
@rchiodo It would be really great if you could manage to capture these "output frames". Quick profiling with Attached is an example of the jupyter display. See the "frame/window" that has popped up on the lower half of the screen which partially obscures the unscrolled "normal jupyter window/frame". Note this is not a separate browser tab or window but a From what I can tell, jupyter call this "pager" messages/output. See also the |
Hmm, not sure that's possible at the moment. Might require changes to the jupyter api. We don't get any pager results through their web api. We get a single stream output with nothing in it. |
@rchiodo Apologies, I found the solution already. At first glance it appears trivial:
After running this, all pager output appears in normal output cells. It might be worth sending this automatically to jupyter when a kernel is started/restarted. |
Sweet, thanks a bunch, that's likely what we'll do. We already have a bunch of stuff we run at startup. |
@ARF1 Do you know of a solution for printing |
@rickhg12hs Sorry no. Might be a question to ask the jupyter project though with a new issue... |
dupe of microsoft/vscode-python#6900 |
Same. Doesn't appear to have any effect on magic commands of using ? for help. |
Hi,
I have tried for several hours multiple examples, it seems i can't get the magic function %prun to print its output.
When I run it, it seems it is working and after it is finished, it does not print the related output.
My pip list is:
Package Version
astroid 2.2.5
attrs 19.1.0
backcall 0.1.0
bleach 3.1.0
Cython 0.29.13
decorator 4.4.0
defusedxml 0.6.0
entrypoints 0.3
ipykernel 5.1.2
ipython 7.8.0
ipython-genutils 0.2.0
ipywidgets 7.5.1
isort 4.3.21
jedi 0.15.1
Jinja2 2.10.1
jsonschema 3.0.2
jupyter 1.0.0
jupyter-client 5.3.1
jupyter-console 6.0.0
jupyter-core 4.5.0
lazy-object-proxy 1.4.2
MarkupSafe 1.1.1
mccabe 0.6.1
mistune 0.8.4
nbconvert 5.6.0
nbformat 4.4.0
notebook 6.0.1
numpy 1.17.2
packaging 19.1
pandas 0.25.1
pandocfilters 1.4.2
parso 0.5.1
pexpect 4.7.0
pickleshare 0.7.5
pip 19.2.3
pip-review 1.0
prometheus-client 0.7.1
prompt-toolkit 2.0.9
ptyprocess 0.6.0
Pygments 2.4.2
pylint 2.3.1
pymongo 3.9.0
pyparsing 2.4.2
pyrsistent 0.15.4
python-dateutil 2.8.0
pytz 2019.2
pyzmq 18.1.0
qtconsole 4.5.5
Send2Trash 1.5.0
setuptools 41.2.0
six 1.12.0
terminado 0.8.2
testpath 0.4.2
tornado 6.0.3
traitlets 4.3.2
typed-ast 1.4.0
wcwidth 0.1.7
webencodings 0.5.1
widgetsnbextension 3.5.1
wrapt 1.11.2
Also the related screenshot with the code cell and my attempts:
Many thanks in advance!
EDIT:
Copy pasted the code from the screenshot for ease of reference (the code is an example from the web testing the %prun magic function: http://gouthamanbalaraman.com/blog/profiling-python-jupyter-notebooks.html ):
import numpy as np
def func(n, a):
y = np.arange(n)
y = np.exp(-y*a)
return y
def gunc(n, a):
y = np.exp(-n*a)
return y
def hunc(n, a):
y1 = func(n, a)
y2 = gunc(n, a)
return y1, y2
The text was updated successfully, but these errors were encountered: