I recently switched from VS Code to Pycharm Pro for my Python development. I do quite a lot of work in Jupyter notebooks. While both VS Code and Pycharm support running Jupyter notebooks, but for some reason, Pycharm refuses to actually make the output, even though it clearly finishes executing the cell.
When I run the cells in VS Code:
opening the notebook in a text editor afterwards:
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "dff0c4eff53e11e0",
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-11T09:17:35.643760Z",
"start_time": "2024-06-11T09:17:35.624653Z"
}
},
"outputs": [ <----- filled output
{
"data": {
"text/plain": [
"'c:\\\\Users\\\\Matthijs.Kramer\\\\mambaforge\\\\envs\\\\marine_verif\\\\python.exe'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import sys\n",
"sys.executable"
]
},
Cells have incremental numbers, so execution completed. Opening in text editor afterwards:
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "dff0c4eff53e11e0",
"metadata": {
"ExecuteTime": {
"end_time": "2024-06-11T09:17:35.643760Z",
"start_time": "2024-06-11T09:17:35.624653Z"
}
},
"outputs": [], <----- no output
"source": [
"import sys\n",
"sys.executable"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8e894d25f58547a7",
"metadata": {},
"outputs": [], <----- no output
"source": [
"print(sys.executable)"
]
},
I also see new variables (in this case foo = 3) appear in the Jupyter variables window, so the kernel is working properly. I can also work normally with the notebooks when they're open in a browser.
Also, when I run the notebook in VS Code so the cell outputs are filled, and I restart the notebook in Pycharm, it will show the outputs, but I cannot clear them... It seems Pycharm is having issues interacting with the output part of every cell.
How do I get Pycharm to both fill and display Jupyter cell outputs?
This problem of the PyCharm itself. The solution, just restart the core. https://youtrack.jetbrains.com/issue/IJPL-59401/Jupyter-notbook-output-not-being-displayed