No way to edit or run Jupyter notebooks in "preview" pane in 2019.1

Answered

I know a lot of people are complaining about Jupyter Notebooks in 2019.1 and it's pretty bad, but I haven't seen anyone talk about what I find the very most annoying. Being forced to edit the notebook in code view.

I find it infuriating that I can just run through the cells in preview mode and make changes to the variables and just hit shift-enter like in a regular Notebook and run through all my code. That would make the the fact that you can't run multiple cells more tolerable at least.

But more importantly when I am reviewing someone else's notebook, I don't even really want to have access to the code, let alone be forced to edit in it. I just want to run down the notebook, maybe change a few variables here and there and run those cells again. 

Am I doing something wrong? Is there a way to turn on editing in "preview". Just can't even imagine how and why Jetbrains would ever think it would be a good idea to take away the core functionality of Jupyter Notebooks. I mean what's the point? If you are in preview mode, what are you going to do, just look at the code? Just don't understand.

10
7 comments

Hi,

There is a corresponding feature request for running all cells https://youtrack.jetbrains.com/issue/PY-32071, please vote for it and follow for updates.

There is also a number of feature request related to Preview (like https://youtrack.jetbrains.com/issue/PY-34421 or https://youtrack.jetbrains.com/issue/PY-32353). I couldn't find the one which would meet your requirements on editing and running the code in Preview, so please feel free to submit a feature request about it.

0
Avatar
Permanently deleted user

I have been using jupyter notebooks in Intellij IDEA Ultimate (the running notebooks feature is equivalent to that of Pycharm, so I will just call it the IDE) and I share the feeling.

I use both notebooks and the IDE a lot, and the best balance I reached was having half screen with the IDE to edit code, and half the screen with a browser with jupyter notebooks running using in the first cell

%load_ext autoreload
%autoreload 2

So I can edit code in the IDE with the nice features it has for intellisense and navigation of the code, and run it in the notebook to see results and keep state. Obviously in this way I miss several essential features of the IDE: debugging, navigation of the code from the notebook, intellisense in the notebook, link to the code from the stacktrace since it's in the notebook ...

When the feature was added to the 2019 edition, I started doing the same but all in the IDE, code and notebook. It kind of works, but being forced to have the code of the notebook in one side and the preview on the other simply breaks all the comfort that I could have by just having the preview and editing+running it. Having the preview and use half of the screen to navigate and edit code, that would be my ideal version of this.

I went back to using half screen for the IDE and half for a normal browser and normal jupyter notebooks, with the added pain that now I miss even more those essential features I mentioned above when working like this.

It is in the plans to have a proper jupyter notebook running in the IDE with all the fantastic features of Pycharm/Intellij?

 

1

Hi Rpicatoste,

Thank you very much for your feedback. Indeed, some users miss the old way of working with Jupyter Notebook files where they have the code and the preview in the same place. But honestly, since you still see the source code in the preview, is it really that uncomfortable to edit it on the left side?

IMHO: I think that it actually helps to see a bigger picture of your code because the preview is mostly needed to see the output of your code. Maybe I miss something in the workflow since I'm not using Jupyter Notebook on a daily basis, but I would appreciate if you could provide some more insights. Would be even better if you could formulate it in the scope of a feature request in our tracker https://youtrack.jetbrains.com/issue/PY

Thank you!

0
Avatar
Permanently deleted user

Hi Sergey,

Thank you for the interest shown. I am going to try to illustrate my workflow with notebooks (which I use almost all day at the moment and likely for a long time).

Before the feature to run notebooks in the IDE (Pycharm/Intellij), my screen is divided as shown below. It is a example I made just to show:

On the left side I have a medium to big project which I navigate with the IDE (intellisense, ctrl + click on name of the item, shortcuts to move back and forth in the code, refactors, etc etc).

However my work depends as much on analysis of the data as it does on the code, so the 2nd half of the screen is jupyter, where I see the plots of data, outcome of process, etc. So far jupyter is highly convenient for that, in spite of its huge drawbacks (like version control and lacking the features that the IDE provides). The first cell in the example is essential to this way of work, because I can keep the state of the notebook but change code in the project, and run it on the notebook without restarting the kernel.

Using the IDE feature for the notebooks, my screen looks like this:

So this is not bad, but the only way to use the notebook interactively is with both code and preview. If I hide one of them, there is no possible interactivity.

I could be swapping code and notebook, but I really like having at least 2 things side by side. And the way the notebooks are done, the result is the screen divided in 3, forcing me to resize often to see the outputs in the preview. This is even slower because I don't think there are keyboard shortcuts to move quickly between code and preview, at least I didn't find. (and I don't mean between tabs in the IDE).

As you can see, I tuned slightly the notebook to have at least a visual separation between cells in the code.

Maybe when the shortcuts are more robust and there are more buttons to clean the preview (both in ongoing issues) I will keep trying, but what I show above cannot improve unless the preview can be used as in the standard jupyter notebooks.

In summary, I can't wait for a jupyter notebook feature in the IDE where the preview mode looks and behaves similarly to the standard jupyter notebooks.

PS: this is probably just me. I would actually like to know how other people work with code and notebooks combined.

1
Avatar
Permanently deleted user

Finally I made a request out of it:

https://youtrack.jetbrains.com/issue/PY-37015

I hope more people is interested, either because they work in a similar way, or because a more jupyter-like behaviour is preferable for other reasons.

0

Oh, I see, thanks for the clarification.

I think there is a relevant ticket in our tracker https://youtrack.jetbrains.com/issue/PY-23843, feel free to vote and follow for updates.

Vote for https://youtrack.jetbrains.com/issue/PY-35360 if you find it useful.

0
Avatar
Permanently deleted user

Hi @Sergey Karpov,

Is making the preview of the jupyter notebooks interactive, so we can hide the "Editor view" of the notebook?

I keep trying to switch to only Intellij/Pycharm but honestly is quite frustrating. Some bugs were fixed in 2019.2 which made it a bit better, but the essential way of working remains the same.

Thanks!

0

Please sign in to leave a comment.