Many times IPython notebook gets stuck showing active cells as [*] but not doing anything anymore. This happens on cells which usually only take milliseconds to execute. It may even happen after a fresh startup of IPython. It happens particularly often after %matplotlib commands. Occasionally it continues after a very long waiting time.
How can I find out what's going on? Where can I try to find error messages or so?
I've started with the --debug option but don't see anything special there. It's certainly possible that the firewall configuration is weird , but how can I configure IPython for that?
Related
I am working with visual studio code (python) using ssh to access a remote server (where the code is located). I am able to write code, run and debug without any problem. However I am not able to generate matplotlib figures during debug in the same way as i can do it without the ssh connection.
I've tried to follow several suggestions from internet and other post here but none of them is fully working.
I've tried the option of " Jupiter> Debug current file in interactive window " but it does not work. I am not sure why, but the debug in the interactive window is not responding and i can not work during debug.
I've tried python debug and the only matplotlib backend that works is (matplotlib.use("WebAgg"). However for this backend it only works with one figure and the debug is block after the plot.
I have also tried to use X.Org (in my case xquartz over mac) but the figures are really slow and it is not useful.
Any idea on how to plot figures during debug in the same way as in local development?
Thanks!
I asked this question in GitHub and got the following answers:
One way to do this is to do the 'Debug your current file in the interactive window'.
There's a bunch of caveats though.
You need to have ipykernel installed into the python environment
you're using. If you run that command it should have asked you to do
so.
It's likely easier to use if you put cell markers around pieces of
code # %%. This would also allow you to prerun bits of your script
before you need to debug the part that's causing problems. This is
what it looks like when you do that:
When debugging in the interactive window, your code in your script
is running as an IPython cell. If you split it up, it might be
multiple cells or it could be one large cell (for the whole file).
As you step, the cell execution is moved forward one line at a time.
However the execution is paused in between steps. This means
anything you type in the interactive window won't be executed.
Instead you have to run extra code in the 'debugger console'. Shown
below:
This debugger console is where you can run normal matplotlib
commands.
For some reason today my Jupyter Notebook has decided it doesn't want to execute the code in cells. However this isn't consistent. I'll restart the kernal, it will work for a while, but then when it runs into an error it then won't execute any code in any other cells after that without a kernal restart.
I've seen a previous post on this but using jupyter troubleshoot only printed out all the packages and no useful information and I also don't appear to have nbextensions dubplicated anyway.
I'm using python 3.7.8 and Jupyter_client 6.1.6
Sorry I don't have much more information, but I'm not really sure what other information to give/look for.
What kind of errors do you mean by "when it runs into an error it then won't execute any code in any other cells after that without a kernal restart"?
I know that if you have In [*] instead of the run number of the cell for a long time probably you have an infinite loop in this cell or an open input (an input that waiting to your answer). Is this the situation?
This is a bug in Jupyter which is somehow connected to Qt, see this issue on Github
https://github.com/jupyter/notebook/issues/6526
It is probably rare...
I recently opened Spyder after a really long time, and my IPython console immediately showed some leftover commands? Do they affect my next code, and if they do, how can I get rid of them? Screenshot
EDIT Solved: all i had to do is turn off symbolic mathematics in preferences/ipython console/advanced settings. When I turn it back on, it shows again. I would like to know is there any better solution for this?
I just started trying out PyCharm, and while it is very nice, I found the interactive console in debugger (that can be activated with "Show Python Prompt" on a breakpoint) is unusably slow. If I keep pressing enter, for example, after 2-3 tries, I have to wait several seconds for the next prompt to show up.
Is this a common experience? I'm running Pycharm with a pretty fast machine (with i7-3770 CPU) so I was wondering if something is wrong.
I too have experienced the same problem quite a few times but With every new version released new problem too pop out . Its not the first time PyCharm is giving some one a hard time. In previous version the IDE would just stop working or not debug at all .
The best way to solve this is by writing to Jet Brains so they can find and solve the issue and release a new update.
I use IPython very frequently and happily. Somehow, cutting text from the shell using the keyboard shortcut, Ctrl + X, is broken. Actually, I have a few different installations of IPython. In some of the installations, the shortcut works; in the others, it doesn't work.
What might be the reason for this? Where should I look into?
You say you have multiple instances installed -- are these all on different machines? What operating system(s) are they running? If you access them remotely, what operating system are you running?
Do you get to them using ssh? Do you run something like screen, either locally or remotely, or both? There are lots of things that can interfere with your terminal settings, especially when you're working remotely.
I'm almost certain that iPython doesn't have anything to do with it -- though you might want to check the version numbers, to see if working and non-working environments are running different versions.
More likely, it is something in the terminal emulation layer, but you'll likely have to do some detective work of your own to find out what piece is causing it.
Take it one step at a time -- try to cut from a local shell, to make sure that works. Then connect to a remote machine, and cut from that shell. Start screen, if that's your normal way of doing things, and test from that shell. Then start ipython. If it stops there, then see if you can find another application on the same machine that's linked against gnu readline, and try that. You may find that none of the console apps cut proplerly on that machine, or you may find that they work, but not under screen. Or you may find that something in the terminal settings stops everything from working as soon as you ssh in.
You may also have some luck. if you can find out what terminal the remote machine thinks you are using ( echo $TERM ) by copying the termcap file from a working machine to one that doesn't. That's a bit more involved for these forums, though -- I'd repost at that point on serverfault.com or superuser.com
I hope that at least gives you a starting place -- terminals are finicky, and difficult to get right. Most people seem to not bother, as long as everything mostly works.