I was recently introduced to JupyterLab and I have seen this video from the documentation, where they introduce the synchronised "output view" of a cell:
https://youtu.be/Asa_ML45HP8
I wonder if it was possible to have "only" this output view as the result of executing a script. So that I could run a Python script, and a browser window would open up and I would see only the output view without the Jupyter interface itself.
Is this or something similar easily feasible already? E.g. by configuring JupyterLab in some way and then starting it?
If I wanted to write an application that does that, do you have hints on where to start from? I presume, that there is a lot of code already present that could be reused.
Related
I wanted to give VSC a try for developing some Python programs, where I only used PyCharm before. One of the most helpful features for me in Pycharm was the PyDev Console, where I can quickly try small snippets of code (think 3-10 lines), and adjust it to work the way I want it to.
I see VSC has a console, but it's much more like the regular IDLE console, where it's kind of hard to write these snippets of code (fixing something 2 lines prior for example is pretty much impossible).
I've been searching for an extension that'll give me a PyCharm-like console experience in VSC, but have been unable to find one. Is is out there? Or is there another way to get to the same result (like setting up a custom console based on the same PyDev console)?
Have you tried Jupyter Notebook and Interactive? There are provided by the Jupyter Extension which is bound with Python Extension.
Open the Command Palette (Ctrl+Shift+P), with the command of:
Jupyter: Create New Blank Notebook
Jupyter: Create Interactive Window
You can refer to the official docs for more details.
It's been a little over a month since I'm using Jupyter notebooks, as an inbuilt extension within Visual Studio Code, and am pretty satisfied with it. However, recently I've been noticing that sometimes for no particular reason, I get a "direct kernel connection broken" error message when I attempt to run the specific cell upon which I'm working at that moment.
I do understand that this might be due to some errors that regularly creep up in my code, but something that I've noticed is that, say for instance that a particular snippet of the code that I've written is buggy. When I run the snippet in the traditional Jupyter Notebook (via my power shell, hosted as a web-based browser application) it shows the nature of the error, and where exactly has it occurred in the body of the program. For the VS Code based Jupyter Notebook extension, it does nothing of that sort and just displays a "Direct kernel connection broken" error message.
I have tried everything - from interrupting the kernel by toggling the red square key to restarting the kernel with the help of the green 'reload' key, but nothing seems to change. Occasionally during this issue, If close and open VS Code, or start coding in a new blank notebook, then this small trick does seem to return the kernel state back to normal. Nevertheless, I'm growing increasingly tired of this temporary fixture and was hoping to fix this issue permanently.
Edit: For further clarification, I have added two pictures for comparison. Both the snapshots are of the same snippet of code. The first picture is of my code running on a traditional Jupyter Notebook ( and it seems to work fine ).
The second picture is a snapshot of the same code snippet, running on VS Code's Extension for Jupyter Notebook.
For further information, kindly refer to the comments below.
Lately, I've been running some Jupyter notebooks in VS Code, and I've been encountering a strange issue: whenever I open such a file, I am bombarded with pop-ups that look like this:
Sometimes a few will pop up; other times it can be upwards of 10 pop-ups. What's bizarre about this is that I already have my VS Code set up properly, and I can run my Jupyter notebooks just fine. I've tried selecting the 'Modify' option and going with the default selections just to make it go away, but no dice. How do I prevent these annoying pop-ups?
Per your new comments, can you check your default settings to see which application is targeted to open .ipynb files? Perhaps .ipynb files are linked to open (strangely) via the Setup exe.
Is there a way to customize (e.g., JSON config) the 'Python Interactive' Window to iPython/Jupyter console that comes with the MS Python extension?
I would like to be able to adjust the size of the variable explorer pane within the window (it can't currently be resized and takes up a bit of screen space.
I would also like the iPython console to look/operate like the native iPython console. That is, have an open console and be able to submit commands just by hitting enter (vs. the default shift+enter). Ideally, I'd like to be able to have it look/operate like Spyder's interactive console. Any thoughts or ideas would be appreciated.
As a workaround I can launch an iPython session from the integrated terminal then select all code from the editor and send it to the terminal (which then gets sent into iPython), but this is not ideal and loses the advantage of the interactive window and the built-in variable explorer which is very nice! Thanks
I'm a developer on this extension. We don't currently have these customizations that you are looking for. But if you would like to report these as enhancements then you could report them on our github here:
https://github.com/microsoft/vscode-python/issues
That's the best way to get attention for adding a new feature.
I started using Pycharm and managed to have the python prompt running after a file is run (link) and I found how to run pieces of code in the current iPython console (link).
For data science, however, it is very convenient to have a single iPython console/Python kernel where I can run files and code, just like Spyder does, and continue using the same started python kernel. For example to load a big amount of data with a script and write another script or pieces of code for plotting in different ways, exploring the data.
Is there a way in Pycharm to do it?
I think that it would imply generating automatically and running a line like:
runfile('C:/temp/my_project/src/console/load_data.py', wdir='C:/temp/my_project/src')
If the option does not exist, is it possible to make a macro or similar to do it?
The option "Single instance only" in Edit configurations doesn't help.