Jupyter Running Wrong Cell in VSCode - python

I'm using the Jupyter extension on VSCode, Windows 10. I'm using Python through Anaconda.
I'm using a jupyter notebook and am running several different cells. After I run some of the cells a few times and restart the kernel a few times (to allow modules that I edited to update for the notebook), the notebook eventually stops running the correct cell. No matter what cell I try to run, it always runs the same cell, which is directly below my most used cell/the cell I used last. Opening and closing VSCode works but is only a temporary solution, and the issue has been arising more often. Does anyone know how to fix this?

Related

Python kernel automatically changes back to base in VS Code

I am trying to connect to a different environment for jupyter notebook in VS Code. I have settings.json as in the following:
"python.defaultInterpreterPath": "C:\\Users\\username\\.conda\\envs\\analytics\\python.exe"
I have manually added python path in select python interpreter
I have tried almost every solution, but I am unable to change kernel. Whenever I Reload Window it selects the intended kernel for a few seconds and then it changes back to base. I have never encountered this problem before, I have just installed anaconda and VS Code on this system. Can someone help me with this problem?

Plotting in VS Code-Server (Python)

I setup a Visiual Studio Code-Sever on a Raspbarry Pi. I access the server via Safari from my Ipad. I can run scripts but I can not output plots. It is obvious that plt.show() does not work so I tried jupyter, but the interactive window remains black after I run the cell. There is no error to report but vs code is trying to install jupyter once again, although it is installed in my virtual environment. Similar problems occur when I try to start the output pane of neuron (it is not showing up at all).
Does anyone have ideas or ever had similar errors? It seems that jupyter cannot be accessed correctly.
Best regards!

PyCharm - how do I debug (like in Jupyter Notebook) without having to re-run the full script every-time that I modify code?

I'm new to coding and to PyCharm. I've learned with Jupyter and trying to get my head around PyCharm debugging (using single/multiple breakpoints).
What I liked about Jupyter is that when you put your code into different blocks, run them to output lists which you'll then be working with (the lists - as long as you haven't done anything to permanently affect them, but in that case, I would do new_list = og_list.copy() and play with the new list, to avoid re-running all of the code above) to create/test your next lines of codes, I can't figure out a way to proceed in the same way into PyCharm/Debugging.
In PyCharm, the way that I am using it, it seems that every time that I am changing a line of code to re-test/debug, I need to run the full code once again. I know I must be doing it wrong. I've played a few videos now and read a few posts online but I still can't seem to get it. Anyone here available to help?
Are you aware that you could write jupyter notebooks in PyCharm? - The cell functionality of jupyter notebook is only given in jupyter notebook and ipython as far as I know.
You may also open a iPython-shell in PyCharm.
Also, remember that you can easily convert a jupyter notebook to a .py-File, so nothings prevents you from writing code in jupyter notebook.

Jupyter Notebook not executing cells/code

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...

Jupyter Notebook Kernel Crashing in VSCODE

I am interested in using VSCode's Jupyter notebook functionality and I am just trying to get to grips with it. I can start the kernel and run the notebook cells in VSCode.
After running particular cells it seems to crash with no warning and the code fails as the variables have been cleared. I have to reselect the kernel in the top right and start running the code again from the beginning until I get to the problem cells, and then the issue repeats itself.
I don't think it's anything to do with the Python code, it's some simple dataframe manipulation. I have tried the same notebook just running it in the browser and it works fine.I am running Jupyter through a venv with Python 3.7.6, MacOS Catalina (10.15.4), VSCode 1.45.1.
Something I noticed that might help indicate what is happening, is when it crashes I can run basic python statements in the notebook cells (without reselecting the kernel). But when I run my cell which tries to import tests from a .py file in the same folder or import data files using a relative path, it can't find them until I reselect the kernel. It seems like the cwd has changed? Can anyone assist with this?

Categories